The worms dealt with in the DreamWorks Dragons Franchise are more specifically referred to as "segmented worms" and belong to the Phylum Annelida. There are at least 17,000 known species of segmented worms on the planet, in nearly every ecological niche. Some are extremely important ecologically, while others are parasitic and live inside other, larger organisms. So far, there are only two featured in the Game, School of Dragons, which, ambiguously, are somewhat interchangeable in the game.
The Lugworm(Arenicola marina) is available as fish bait in the School of Dragons store. It looks in the game and in real life very similar to the more commonly known earthworm, but are related only by both being in the same Phylum. Lug worms live in coastal sand and is rarely seen, except when dug out to use for fishing. More often the squiggly casts of their burrows are seen above the sand.
The term "Earthworm" actually generally refers to larger members of the Order Oligochaeta. They typically feed on organic matter or detritus in the soil, producing even richer plant accessible nutrients. Their underground activity also breaks up and aerates soil, which is beneficial to plant life.
The Lug Worm can be bought from Trader Johann's store directly for 8 coins each and used as fish bait.
There is a Composter farm implement that takes 5 spoiled crops (those that have exceeded harvest time) and gives five worms to use as fish bait bait. The composter is introduced in the Quest "Gathering and Composting". Earthworms are the type of worms found in compost material, not lug worms. However, once harvested in the game, they are lumped together with lug worms, which is not accurate. Both earthworm and lug worm, however, in-game and outside of the game, can be used for fish bait.
Earthworms are mentioned directly by Snotlout in the quest "The Wolves are Coming." Snotlout mentions that he has seen Wild boars eat many other kinds of animals, including earthworms.
Wild boars eat almost anything from roots to earthworms. I've even see them snatching a snake or two!
— Snotlout in School of Dragons
Worms also appear in a Stable Quest players can send their non-active dragons on called "Grubalicious". The Raincutter is the best dragon for this Quest, though others can be used for a reduced success rate. The quest takes 24 hours and a successful mission yields 920 coins, 1440 Dragon Experience points, and 150 Ultimate Dragon Trainer points.
Worms are also mentioned by Mulch as food for fish (along with bread crumbs and mosquitoes) in the play quest "Learn About the Food Chain".
Worms are mentioned very briefly in this game when describing the Raincutter, and the Raincutter individuals, Thump and Dewdrop. Raincutters prefer eating grubs and worms, and Thump brings gifts of worms to Valka as gifts.
This long-necked Sharp Class Dragon LOVES rainy days. The wetter, the better! That's when it does its best hunting and foraging... for wiggly worms. Yuck!
— About the Raincutter
This Raincutter had her wing sliced by a trapper's razor netting. She is forever grateful to Valka for rescuing her, often bringing her slimy worm and grub snacks as gifts!