(CNN) Two hikers who were missing for nearly five days used a water-purifying straw to survive and were rescued after search teams discovered and followed two sets of footprints in a California canyon, according to the local sheriff's office.

Eric Desplinter, 33, and Gabrielle Wallace, 31, got lost while hiking near Mount Baldy in San Bernardino County, California, last Saturday.

"We just lost the trail," Desplinter said after being rescued Wednesday night, according to CNN affiliate KCAL/KCBS . "And had a little bit of a slip going to the peak of Cucamonga Peak. We decided we wouldn't go back up the ice and snow, so we tried to descend through a valley."

"But that valley was more treacherous than we thought," he added.

To survive over the next several days, Desplinter said he and Wallace tried their best to keep warm, rationed their food and drank water through a LifeStraw -- a straw-like tube that purifies water. They're used by hikers and have also been used for humanitarian purposes, providing clean water to people who might not have access to it otherwise.

Read More