Sorry for not getting here sooner. First off, Thank you for your service.
There are two common problems that can cause the issue you are having.
The most common is bad solder joints on the selector switch in the dash. They were not soldered "hot" enough and the joints fail. Then you get random selection as the joints connect/fail. If you know how to solder they are easy to fix, the switch comes out by removing the trim bezel around the instrument panel. then the switch pack comes out and you can disconnect the switch wiring and remove the 4X4 switch. Then you open the housing and look close at the board for the bad solder joints and use an iron to re-flow the solder. Or replace the switch with a new one.
https://www.youtube.com/watch?v=6FVEH6LNzDA shows this repair.
The next most common is the transfer case encoder motor sensor these fail for basically the same reason, the solder wasn't correct. However these are not as easy to repair so normally they just get replaced. It isn't a difficult job to do but it may require you to remove the front driveshaft to get the unit to lift off the shift shaft. I've has a couple where the motor would clear but most won't.
Then it's a basic R&R. Be 100% sure the case is in neutral and that the new encoder is as well, use a new gasket and an aligning pin to make it easier.
If you want to be sure which one to tackle first or just don't want to DIY you could have a dealer or good independent shop scan it and get their opinion as to which is the more likely problem based on the codes stored in the TCCM.
Images (Click to make bigger)
Wednesday, November 29th, 2017 AT 6:25 PM