likely a gearbox or transfer case issue. best case just a shift linkage issue, but if you heard a load noise, probably not.
it could possibly be elsewhere in the driveline, but the gearbox or t-case would be most likely.
you will need to have the vehicle raised on a hoist for inspection to verify the cause
Sorry if you were hoping for a different answer, please don't shoot the messenger - I can only give the honest answer, which I have. Please remember that a low rating PUNISHES me for my honest and prompt response, and I receive nothing for my time and answer until a positive rating is clicked.Please let me know if you have further questions. Please do not forget to click a positive rating as this is the only way I receive credit for my answer, thank you. Best wishes with your vehicle.