Well, first it would be to define what a worm is .
A worm is an invertebrate animal that reproduces asexually (it does not need a male or a female) Likewise, worms remain as such, they are born as worms and die as worms (worm and proud, moterfuckers!!!!) This would be a type of flatworm:
On the other hand, there are the larvae, which are similar to worms, with the difference that they are some type of insect before reaching the adult stage. As for example in the case of a caterpillar that becomes a butterfly.
Well, answering the question. Personally, I think that everything depends on the food of the being you want to eat , since if the worm or whatever it was feeds on rotting remains in poor condition, it would give you a serious stomach ache or even an infection. Because those animals may be immune to certain pathogens that are in what they eat, but we are not.
Now, personally, I have never eaten any worms (well, I have never consciously eaten one, maybe I swallowed one or another in my sleep lol).
But I do have experience with one type of larva. In the Peruvian Amazon, the larva of Rhynchophorus palmarum is well known, a species of beetle that takes the name “suri” in its larval stage. His appearance is somewhat peculiar. In the following image you can see in a better way what I mean.
Although it looks like a fly larva on steroids, it is completely harmless and its diet is based on wood. It lives inside the trunk of a type of palm tree where it remains all its life until it becomes a beetle, which usually lasts approximately 220 days. Its high protein value makes it a favorite in the diet of some indigenous peoples.
Now about its flavor, at first it seemed a bit strange to me due to its texture. But as I was chewing it, it gave me the sensation of eating crab hahaha.
So you know, if you eat a worm that lives and eats in the trash, you’ll probably get a one-way ticket to the hospital. But some species of larvae are very healthy, even if their appearance puts them on the list of ugliest animals lol.