Hello and welcome to JustAnswer!
If you can move the pintle of the range sensor by hand and make the shift indicator lights show the correct position you know the sensor, wiring, and the instrument cluster are ok. This leaves only an internal trans issue. The pintle of the sensor runs on a plastic piece on the valve body's rooster comb. This plastic piece will sometimes break and there will be nothing to push the sensor to the correct position for each gear. This often happens if a valve body is removed and installed without removing the range sensor, it will catch on the plastic piece and break it off. If this plastic piece is broken the valve body will need to be replaced.
There was actually a recall on the older trucks for some programming changes to add the alarm. Somebody definitely must have gotten out of their truck with it running in gear!
If you've pulled valve bodies before this one shouldn't give you any more trouble than normal. You'll pull the linkage from the left side of the trans, remove the range sensor, unplug the 8 way solenoid pack connector from just behind the shift linkage. Obviously drop the pan and the filter. At this point if you are working on the ground you'll want to chock the wheels and set the emergency brake. You'll either rotate the linkage to the manual first position and remove the C clip on the park rod, or you'll just pull the park rod out with the valve body. Obviously the truck is able to roll on it's own then, hence the E brake and chocks.
Then you'll just remove the 7/16" bolts holding the valve body in. On the right side you'll find one accumulator piston with either one or two springs. The springs are huge on one side and small on the other, no way to get it wrong, and the same with the piston direction. You can't get it wrong. There is no gasket between the valve body and case to have to worry about either. When you go back together you'll torque the valve body bolts to 100 in lbs. If you've ever had the valve body out of an old Chrysler Torqueflite, this is the same trans, only it has an electronic governor with a solenoid and transducer on the right side of the valve body.
That's what I would do. If the sensor works but not when it's installed you don't have anything else really but the valve body to cause it, but I'd definitely have a look at it before ordering one. Good luck with it!