Automatic or Manual trans??
Manual will be the same, so no problems
Automatic is a different story.
The bellhousing will match since both are for 4.0l, and tailshaft housing will match because both are 4x4
But the model of transmission "may not" match
1995-2001 4.0L Rangers could have come with a 4R55E automatic, 4-speed
OR......
1997 - 2009 4.0L Rangers came with 5R55E, 5-speed
depends on where they were built
1997-2001 Explorer w/4.0L came with 5R55E
So you got a 5R55E from a 1999 Explorer
Look at your Drivers Door tag for the TRANS code letter
T = 4R
D = 5R
They are essentially the same transmission, just the computer software to run them is different.
The "5th gear" added to the 5R was a new 2nd gear, but it wasn't a physical change in the transmission
There was a wide gap in ratios on the 4R trans between 1st and 2nd
So Ford change computer software to "add" a new 2nd gear
when starting off in 1st the 5R will turn Overdrive(OD) ON when RPMs get too high, that is now "2nd gear", then when RPMs get high again OD is turned off and the shift to "3rd gear" happens.
3rd gear is 2nd gear on the 4R
4R gear ratios 2.47 /........../ 1.47 / 1.00 / 0.75
5R gear ratios 2.47 / 1.87 / 1.47 / 1.00 / 0.75
2.47 with .75 = 1.87
Makes for smoother shifting
Since there are no new solenoids added or changes in wiring, the 5R may work fine with 4R software, as a 4-speed of course