A tried and true way to navigate, but one that is worth repeating and committing to memory.

seen from France
seen from South Korea
seen from United States

seen from Singapore
seen from United States
seen from United States
seen from Germany

seen from Ukraine

seen from T1
seen from United States

seen from Malaysia
seen from United Arab Emirates
seen from China

seen from France

seen from Germany
seen from United States

seen from France
seen from China

seen from United States

seen from China
A tried and true way to navigate, but one that is worth repeating and committing to memory.
Back cover detail from the Boy Scouts of America publication, Be Expert With Map and Compass: The “Orienteering” Handbook - 1967.
Studying for the map and compass portion of the Maine Guide exam.
Northern Maine
Radio orienteers, 1970. From the Budapest Municipal Photography Company archive.
The above link includes articles on lost mushroom hunters in the Pacific Northwest over the past ten years. Many of these people were found deceased, and others were very lucky to have been found alive.
One of the things I really emphasize with foraging is safety, and not just the danger of picking something poisonous. While some people come into this practice with a realistic idea of the risks involved, others have....well, let's just call it a romanticized idea of foraging. They're not wrong in that it can be a fun, fulfilling activity that gets you all kinds of tasty things. But you have to be able to also navigate what can go wrong.
This is especially true for foragers who decide to go off-trail. I see this especially with people looking for mushrooms, because the lure of potential huge flushes of chanterelles, morels, and the like frequently leads people to head out onto public land in areas without marked trails. Sure, these locations are less heavily traveled and so it's more likely you'll stumble across a patch that no one else has gotten to yet. But--you're also more likely to get lost.
I personally tend to not go off-trail because I know for a fact that my sense of direction is abysmal (I've managed to convince myself I was lost on an out-and-back trail more than once.) But if I did, here's what I would do to mitigate the chances of getting lost:
--Take a GPS unit. These make finding your way back a lot easier, especially if you're able to drop pins as you go along or even digitally mark your trail.
--Take a map and compass and know how to use them: GPS isn't perfect, especially if signal is sketchy, and if your battery dies, well, there you go. So a topographic map and a compass make a good backup--if you know how to use them. Many urban areas in the U.S. have orienteering clubs, and failing that there's always YouTube.
--Take biodegradable flagging tape and tie bits of it to branches along the way. Then follow that path back when you're done, taking the tape with you as you go. If you miss one or two, they'll break down pretty quickly. DON'T leave the tape up on purpose to keep the trail to your patch of mushrooms or berries, though; not only are you adding plastic to the local environment, but you're leaving a trail for anyone who finds it.
--Take a friend! If something happens to one of you, the other can go for help. Or, if you're like me, only go off-trail with someone who's much better at orienteering than you are.
Went orienteering for the first time in ... erm ... a while I remember how it works, I swear!