A worm is an elongated soft-bodied invertebrate animal. The most famous is the earthworm, a member of phylum Annelida, but there are hundreds of thousands of different species that live in a wide variety of habitats other than soil.
Originally, the word referred to any creeping or a crawling animal of any kind or size, such as a serpent, caterpillar, snail, or the like. Later this definition was narrowed to the modern definition which still includes several different animal groups. Major phyla include:
Worms may also be called helminths, especially in medical or zoological terminology. Some other invertebrate groups may be called worms, especially colloquially. Many insect larvae are called worms, such as the railroad worm, woodworm, glowworm, or bloodworms.
When an animal, such as a dog, is said to have worms, it means that the dog is infested with parasitic worms such as tapeworm (or the fungal ringworm).