A worm is a small, soft-bodied creature. In the Bible, the word usually means insect larvae, often maggots (the young of flies).
Maggots are mentioned in stories where they feed on:
spoiled manna (Exodus 16:19–20),
corpses (Job 21:26; Isaiah 14:11), or
open wounds (Job 7:5).
Mark 9:48 refers to a maggot that eats dead flesh. In Acts 12:23, King Herod suffers a fatal disease caused by worms. Sometimes “worm” means the young of other insects (Isaiah 51:8).
In Deuteronomy 28:39 and Jonah 4:7 the vine weevil (Cochylis ambiguella) is likely meant. This pest damages vines by boring into their stems.
Calling a person a “worm” is a way of showing extreme humility or shame (Job 25:6; Psalm 22:6).