In Frank Herbert's Dune novel, why is the spice valuable?

Sandworms are colossal, worm-like creatures that live on the desert planet Arrakis. The sandworms' larvae produce a drug called melange (known colloquially as "the spice"), the most essential and valuable commodity in the universe because it makes safe and accurate interstellar travel possible. Melange deposits are found in the sand seas of Arrakis, where the sandworms live and hunt, and harvesting the spice from the sand is a dangerous activity because sandworms are aggressive and territorial. Harvesting vehicles must be airlifted in and out of the sand sea in order to evade sandworm attacks. The struggle over the production and supply of melange is a central theme of the Dune saga.

The spice is valuable because it is a scarce resource that is crucial to interstellar travel. The spice is scarce because it can be found only on planet Arrakis, and its extraction is difficult due to the presence of sandorms.