So the first thing I would try is the following. (please be careful)
Put the truck up on 4 jack stands all wheels safely off the ground. Place the truck in gear and select 4 wheel high. Rear wheels should be turning.
now go to the front axle and you should see an actuator. that is part of the front axle. tap on the actuator don't go crazy and break it but really tap on it and around it. often the front actuator is the cause of the issue and this is the first step I would do.
if the truck suddenly goes into 4x4 while you are tapping you have found the problem.
let me know what happens and we can move to the next step.