There are many types of worms pups can become infected with. The most common ones are roundworms, tapeworms, hookworms, and coccidia (a protozoan parasite).
It is common for puppies to be born with roundworms. They can be passed from their mother before they are born. These are all intestinal parasites and have nothing to do with heartworm.
Tapeworms are caused by ingesting fleas infected with an immature form of the tapeworm. These worms are sometimes referred to as "rice segments" and are often seen around the anal area.
By examining a stool sample under the microscope, it can be determined what worms are present by identifying the parasite's eggs. The proper treatment can be started. Not all worms are treated with the same medicine. Therefore it is not advised to use an over-the-counter dewormer.
A fecal exam is recommended each year with the annual physical exam (more often with puppies).