Place the vehicle on level ground and chock 1 tire on both sides to prevent it for rolling either direction. Place the shifter in N. From under the vehicle with a 15mm wrench carefully loosen the adjusting nut. The rooster cone inside the transmission should now cause it to shift completely into neutral. Re-tighten the adjusting nut. Crawl out, and pat yourself on the back. You need to get the dirt off. Ha ha.
However if the shifter is nowhere close to being in sink with the transmission, you may have another problem. Let's say you put the shifter in P and the transmission is still in gear nor can you get the key out. You put it in D and it seems to do fine. Then your problem may be with the shifter parts that reside in the upper steering column. These parts are Dealer Item Only. If this is you case please re-post with something like how do I replace shifter parts in the steering column on a 1998 Ranger. As I feel way off topic here. And did I mention disconnect the battery ground? Ha ha again. Good luck
Chat with our AI personalities