what a worm actually is
A worm is a chain of segments that shares one health pool and ignores the world around it. Stone, dirt, walls and liquids are all the same substance to it. It swims through solid rock exactly the way other enemies walk on top of it, takes no damage from lava, and cannot be knocked back at all. Segment counts vary from one spawn to the next, so two of the same enemy can be noticeably different lengths.
one health bar, many hitboxes
Because every segment draws from the same pool, a hit on the tail costs the worm as much as a hit on the head. That is the entire strategy. A weapon that pierces several targets in one swing is hitting the same enemy four or five times at once, which is why Flying Dragon, Rainbow Gun and Death Sickle shred worms while a single-target weapon crawls.
Loot drops from the head segments, so a worm that dies with its head buried still gives you the drops. Spears and similar weapons whose projectile visually clips into blocks do connect with a worm inside those blocks, which is unusual and worth remembering when one dives.
listening for them
Every worm except the Leech makes a digging noise as it tunnels near you, and the noise speeds up as it closes. On the surface that is only mildly useful. Underground, where you cannot see anything through the stone, it is the whole warning system: the sound tells you roughly where the next emergence will be, and you can face that direction before the head breaks through instead of after it has already hit you.
Most of them also kick particles out of the blocks they pass through, which gives you a visual trail through terrain. The ones that fly, including Wyvern, Crawltipede, Phantasm Dragon and Milkyway Weaver, spend their time in open air instead and are tracked by eye.
building for the fight
There is no arena shape that keeps a worm out, so build for visibility and mobility rather than cover. Open air above a long platform run gives you room to keep moving while a piercing weapon does the work. Ceilings are a liability, since a worm arriving from above hits you before it renders.
Eater of Worlds is the odd one out among worms and the reason this behavior is worth learning early. It is the only boss sharing the same movement rules as ordinary enemies like Devourer and Giant Worm, so anything you work out fighting a common one carries directly into the boss.
a quirk worth knowing
Kill a worm with autopause on and freeze the frame at the right moment, and hovering the cursor can show a negative health value. Every segment reads the same number, so damaging all of them in the same instant pushes the total below zero before the game gets a chance to notice the thing is dead.
