Sandworm, called Nal (ナール) in the Japanese manual, is a centipede-like Badnik from Sonic & Knuckles found in the quicksands of Sandopolis Zone. They swim around in the quicksand and jump out of it to attack the player. They are very similar to the Caterkiller in terms of appearance, including having the same name in Japanese (as well as using the same sprite sheet (albeit with a different color palette)), but their behavior is different. (They jump back and forth out of sand pits, unlike the Caterkiller Badnik.) But just like the Caterkillers, they can only be destroyed by jumping on their noggins.
They return again in Asteroid Coaster and Planet Wisp in Sonic Colours, as well as in Sonic Generations' version of Planet Wisp, Oil Desert Zone from Sonic the Hedgehog 4: Episode II and Capital City from Sonic Forces. The newer ones remain as stationary turrets, not hopping around like their predecessors. The Sonic Forces version has a drastic change in design, with a modernized and militaristic style. The Sandworms in Oil Desert Zone are much bigger and different in appearance.
The Sandworms in Sonic Lost World vary in location and behavior depending on the version. In the Wii U/PC version, they are found in Sky Road and behave like Caterkillers in that they simply crawl forward, and are defeated with a Focused Homing Attack. In the Nintendo 3DS version, they appear in Windy Hill Zone 1, 2 and the Tutorial stage, serving as obstacles that must be destroyed in order to progress. It attacks by smashing its head at the player, creating a small shockwave but also stunning itself, leaving it vulnerable to multiple Homing Attacks.
||A newly developed large Centipede type Badnik designed for use in desert areas. You never know when they will suddenly emerge from quicksand, and be mindful of its robust body that is resistant to attacks.
— Sonic the Hedgehog 4: Episode II website