There's a 50/50 chance that it will fit. And that's because of the way the stub that the shifter sits on is made.
There are two different shifters for Rangers using the M5OD. 1990-1997, and 1998-2011. These two shifters do not interchange, and the picture below demonstrates why.
I feel you may have a similar issue with the F150 shifter as well, depending on what year truck it came out of.