There are many different types including roundworms, hairworms and gapeworms. The worms all produce eggs which the bird excretes in its droppings. The worm egg could be eaten by a bird, or the egg could hatch and the larval worm could be eaten.
eBay