the transfer box has a differential in it. It needs to feel resistance from both output shafts in order to work. If something is broken in either axle the truck wont move. Activating diff lock locks the differential and enables the car to be driven on one axle. Applying the parking brake is an attempt to fool it and confirms something is wrong in the rear. If you chock the wheels so the truck cannot move and leave it out of gear and no parking brake on, place the transfer case in neutral, climb underneath and turn the parking brake drum by hand. If you can turn it you have confirmed something is broken in the rear axle. Alternatively you can put the parking brake on and jack up ea rear wheel one @ a time and try turning that wheel by hand.
You indicated that the hub splines are fine, the only way verify that is to remove the snap ring and spacers to check them.