If you are riding around, and then get stuck, you should get out of the vehicle and hand the keys to someone else.
You should look at the terrain ahead and decide what is required before you get into trouble.
Select off road mode early
If it looks muddy then probably best to lock the centre diff before entering the mud.
Decide if low range is best.
If it includes water, or is a steep dusty/loose rocky hill, then lock the rear diff first and maybe think about the front diff if it is fairly straight.
Slow and steady with careful planning and as much control as possible reduces the chance you will get stuck, break something, or as often happens run into someone coming along the track the other way.