Sandworms are invulnerable but slow. They move half as fast as the player, but they grow in length, occupying more and more tiles up to a length of 16 tiles.
They cannot be killed by melee attacks, but can be blocked in using Thumpers. Once the head tries to move but has nowhere to go because all neightboring hexes are blocked, the Sandworm explodes into several pieces of Spice.
Their slow speed means that single Sandworms are hardly dangerous. However, a group of Sandworms can mean trouble in less open environments, like clusters of impassable hexes or other realms, like the Dead Caves.
Strategies to defeat sandworms
A lone sandworm is pretty difficult to defeat, because it pathfinds its way to the player, so any series of moves that traps the sandworm will generally also trap the player. One way to do this is to lead a group of sandmen around the head of the sandworm so that they clog all its possible moves, but this is an extremely dangerous maneuver, and difficult to setup.
A somewhat less dangerous way is to run circles around a group of sandworms, so that they clog themselves. When 3 or more sandworms are trying to home in to the player's location in a narrow channel between sand dunes, the chances become much higher that one of them will get trapped and explode. However, the Spice produced will usually be difficult to reach because of the remaining Sandworms.
A rare but effective method is to find a Thumper and push it about 1-2 tiles into a 1-tile wide channel between sand dunes, then lure a sandworm to the Thumper at a sufficient distance that the Sandworm is more drawn to the Thumper than to the player. It will then enter the channel and get stuck and explode. However, this usually requires a coincidental placement of a Thumper close to a narrow channel, which is somewhat rare. Also, sandmen must be kept out of the trap before the Sandworm enters it, which is pretty tricky to setup.
If returning to the Desert after exploring other lands and unlocking other Orbs, it becomes easier to kill a Sandworm. A tame bomberbird can be killed to generate a mine, then a Sandworm can be lured to the mine. The explosion will create a circle of 7 fire tiles that traps the sandworm. Another possibility is to use the Orb of the Dragon or the Orb of Matter to block the Sandworm's way. However, by the time the player unlocks bomberbirds or Orbs of the Dragon or Matter, there is generally no longer much of a reason to kill a Sandworm anymore.