Without more information there is no way to diagnose, or even guess, the issue. Have you looked under the truck at all? A rear driveshaft u-joint letting go could cause a sudden loss of all power or drive and make some nasty noises. If the driveshat or u-joint letting go would also prevent the Park feature from working as it wouldn't keep the vehicle from rolling. This is very obvious by looking at it. Next step is the transfer case letting go. Keep in mind that the chain only provides power to the front when you engage 4wd and has zero to do with power to the rear axle. If you were in 2wd running down the road it shouldn't have been engaged or had any power to it to fail. If the chain did let go it would likely be a catastrophic event and cause the transfer case to lock up, and of course make some bad noises. Just that if you removed the chain from the transfer case the truck would still operate in 2wd, you just wouldn't have 4wd. The next step is the transmission. Just because it's been rebuilt or replaced doesn't mean it was good. A poor rebuild or bad install could cause issues. Trans could have grenaded or a simply solenoid pack could have failed. Torque converter failed, or even the bolts attaching the torque converter to the engine flywheel could have come loose.