1999 Ranger 4.0l will have the 4R55E automatic
Yes, I would have the codes from the computer read, auto parts stores will do that for free.
Have a pencil and paper ready and WRITE THEM DOWN!!!!!!!
"I think the code number was.............." is worse than no code number at all, just FYI
The engine computer controls when the transmission shifts and how it shifts, if the computer thinks there is an engine or transmission problem it will go into what we call "limp mode", so you can "limp" home, lol.
This is really a "safe mode" to prevent further damage if possible.
This will result in harsh shifting, which is actually safer than slip shifting.
So mechanic may be correct, in that a sensor the computer relies on isn't working correctly, sensors rarely fail, but wires get unplugged or corroded.
And sensor doesn't need to be on transmission, could be an engine sensor.
Get the codes read, and DO NOT BUY any parts at that time.
Computer codes are helpful to narrow down where a problem may be, but they can NOT identify a bad sensor, the fact a sensor is mentioned in a code definition usually means that sensor is working or computer wouldn't have recognized the problem.