From Wiki

Sandworms inhabit the desert planet known as arrakis, also known as Dune. They can be miles long, and are linked to the spice, or melange. The desert Fremen often ride them, a task which is an extremely dangerous, and considered a rite of passage in Fremen society. Sandworms are primarily attracted to rhythmic vibrations and will often attack such; they also protect spice fields and seem to have their own territory. Leto II is a worm/human hybrid, and proclaims himself a god, a reference to the Fremen's worship of the worms as mainfestations of god, or Shai-Hulud.