Regular veterinary checkups with stool samples or bloodwork to check for worms are the only ways to prevent a dog from contracting worms, but there is always a small risk of a dog getting worms even with proper preventative care. Dogs can contract worms by ingesting worm eggs off of the ground where infected dogs have shed the worms or the eggs, be born with worms that the mother dog carried and passed on during gestation or through her milk or by being bitten by a mosquito that carries heartworms.
The most common types of canine worms are roundworms, hookworms, whipworms and tapeworms. Heartworms are a problematic worm for dogs but with proper preventative care can be prevented from infesting the heart. Every worm but the heartworm lives and feeds in a dog's intestines, causing weight loss, diarrhea, vomiting and death if left untreated.
Veterinarians can provide dog owners with yearly vaccines that protect against viruses and check a dog's stool for the presence of worms. If the veterinarian notices worms, he or she will prescribe deworming medication and recheck the dog's stool a few weeks later to ensure removal of all worms and eggs.
Heartworm preventatives are chewable pills that help protect dogs from heartworms. This pill is different from dewormer, as it works to prevent heartworms rather than killing an existing infection. Some formulas include medicines that also prevent dogs from contracting hookworms and roundworms.