The term "worm" means different things in different contexts. Different types of worms live in soil and have various effects on the ecology of your garden. The most familiar versions are probably the large earthworms that you find when digging in your garden. But "worms" found in soil range from several feet in length to too small to see without a microscope.
Nightcrawlers are large earthworms with bodies containing up to 150 segments. Nightcrawlers literally eat their way through the soil, digging burrows up to 2 feet deep in the soil and crunching up any soil that gets in their way. This habit explains why earthworms are so good for your garden: They both aerate the soil and convert dead plant matter into nutrient-rich soil. During the day, nightcrawlers rest at the tops of their burrows with their heads just barely protruding. They earn their name because of their nocturnal habits. On cool, damp nights, nightcrawlers emerge completely from their burrows except for their tails, which allow them to make a quick escape in the event of danger. They are frequently gathered by fisherman for use as bait. As the Colorado State University Cooperative Extension concludes, however, with life expectancies of 10 to 15 years and as organisms essential to the health of your garden soil, "earthworms are more productive in the garden than at the end of a fishhook."
Red wigglers are another variety of earthworm best known for functioning as small, living composting units. They are smaller than the nightcrawler, with about 95 body segments. Red wigglers are the top choice for indoor vermicomposting units or worms bins, which allow people without space for an outdoor compost bin to convert their garbage to usable soil. According to the Clemson Cooperative Extension, red wigglers differ from nightcrawlers because they have short lifespans and reproduce quickly, which makes them ideal for vermicomposting units. They will chew their way through anything, ranging from leaf litter to horse manure, converting it to fertile garden soil.
Nematodes, often called roundworms, are soil-dwelling organisms that differ from earthworms. There are many varieties of nematodes, some of them harmful to plants and others helpful, controlling pest populations. Most gardeners are familiar with the pathogenic varieties, which feed on plant roots, causing yellow leaves, wilting and plant death. Because nematodes are microscopic, they are easily transmitted through infected transplants, unfinished compost or contaminated garden tools. Good cultural practices, such as maintaining organic matter in soil and rotating crops, can protect your garden from pathogenic nematodes. Other species and cultivars of plants have partial or complete resistance to infection.