Sand Worm's main attack is Swallow, which removes a party member from the battle for several turns. This is followed by Regurgitate, which will delay the regurgitated character's next turn, but he/she will be usable again. Ending the battle after a character has been Swallowed and before they have been Regurgitated will result in 0 AP being awarded to that character, as if they were in Eject status. Earthquake is Sand Worm's other offensive attack that will hit all party members, but takes several turns to cast.
The easiest way to defeat the Sand Worm is to use Auron's Overdrive: Shooting Star. Completing the button combo will always kill the worm.
If Auron's Overdrive is unavailable, inflicting Darkness status and using a barrage of physical and magical attacks works best. Poisoning it via Bio will cause the Sand Worm to lose several thousand HP every turn. Having Rikku use Shadow Gems (which can be stolen from them) will also cause a lot of damage.