i don't mean this to take a shot at anyone, but i've personally found the best way to avoid worms and virus is to keep away from downloading or visiting stuff that's already illegal. that kind of stuff plus pornography is just asking for your computer to be filled with junk. of course there are exceptions to this rule but i've stayed clear with this.
The best way to avoid viruses and worms is to simply unplug your internet connection and never insert anything into your computer (CDs, flash drives, external hard drives).
I got hit with a HORRIBLE infection by visiting a trusted website (it turned out someone who was advertising with them put out an ad that had a very malicious surprise embedded in it). The website had nothing illegal being hosted on it, did not host pornography, etc. I might have avoided this infection by having Adblock installed on this specific computer, and installed it immediately afterward.
No where is safe online. Kids websites are not safe. Ebay is not safe. Paypal is not safe. Getting online for ten seconds to check your email is not safe.
The only thing you can do is learn how to properly avoid danger and protect yourself. And, for Windows users at least (don't know about others), you can do so completely free without buying a license for an antivirus program.
Qyöt27's information is correct. I recommend following it. Firefox has some really nice add ons that can keep your computer from getting attacked.
In addition to using Spybot Search and Destroy and an antivirus program like Avast!
or AVG (use one or the other, never both), I would also recommend Malwarebytes. Using Spybot, AVG, and Malwarebytes, I have never missed an infection on any of my five devices.
Make sure to update and scan your computer with all of your security tools at least once a week. If you download anything at all, update and scan immediately afterward.
If you'd like to go the extra mile, I'd recommend downloading CCleaner. It is not a virus/malware/spyware removal program, but it helps clean out your temporary files, can sort your startup programs, and can also clean junk out of your registry (It will prompt you to back up your registry when you choose to run this option- Do it just in case! It's very simple and fast).