Nematodes inhabit a wide range of environments, including soil, freshwater, marine habitats, and even as parasites in plants and animals.