It would appear to be something of a myth that it’s possible to get potable water out of a cactus, despite old cowboy movies. The reason behind this is that succulents use a different kind of photosynthesis from normal green plants.
Succulents’ photosynthesis is called CAM which stands for Crassulacean Acid Metabolism. While other plants open their stomates (breathing pores) during the day to take in carbon dioxide and use sunlight as a catalyst for their photosynthesis, CAM plants open them only during the night. On a hot day, of which there are many in the desert where cacti tend to grow, they would otherwise lose too much water.
Since there’s no sunlight in the night to act as a catalyst, carbon dioxide is stored as Malic Acid. Next day, the carbon dioxide is gradually released from the acid.
CAM plants are extremely economical with water. They use about a tenth of the water other plants would use to make the same amount of carbohydrate. The downside for them is that they grow very slowly. For example a saguaro cactus, the iconic tall cactus, takes 50 or more years to grow an arm.
The downside for anyone lost in the desert is that cactus pulp tends to be very acidic, containing not only Malic Acid but also Oxalic Acid, another product of the specialist photosynthesis, and this is toxic to humans.
American Indians knew their onions (or their cacti) and sometimes risked the diarrhoea that drinking from cacti could cause, but generally speaking, the only part of a cactus that should be considered fair game is the fruit.