There is no scientific definition for "worm" it is a convenient colloquial term used to refer to limbless invertebrates that live in soil or water. Besides the true worms there are other animals such as the larval form of some flying insects that resemble worms as well as a limbless lizard that more resembles a worm than anything else.
The true worms fall into one of three phyla: the flatworms (Platyhelminthes), includes the flatworms, tapeworms, and flukes; the roundworms (Nematodes), the threadworms, roundworms, and hookworms and finally what we usually think of as worms, the Annelids the earthworms and marine bristle worms.
A few of these are cultured as food while others (or example, Gill Flukes) are dangerous pathogens of fish.