Here is a transmission ID page: Ford Ranger Automatic Transmission Identification
No, on the 2WD trans, a 4WD transmission will have a different tail shaft housing for the transfer case hook up, on a manual trans you can often just swap the tail shaft housings, but on an automatic you have to disassemble the trans to change it, basically rebuild it.
And you will need the trans to be from a 4.0l Ranger or Explorer, so the bell housing bolts match up, 4.0l OHV or SOHC won't matter as they have similar holes, I think the SOHC has one extra hole.
You need to support the back of the engine when you remove the transmission.
Make sure vehicle can't roll away, no PARK anymore, lol
Remove front and rear drive lines
Remove shifter cable and wiring
Remove starter motor
Remove inspection cover and unbolt torque converter from flexplate, you have to turn it to get all 4 bolts/nuts off, so no spark plugs is helpful
Remove support brackets
Transmission and transfer case come out as one unit
Take lots of pictures, they are basically free now-a-days, they can be very helpful when re-assembling
ONE VERY IMPORTANT THING:
If this is your first automatic trans exchange this will save you ALOT OF MONEY and time
When it is time to re-install the transmission, you need to put the torque converter on the input shaft and then spin it while pushing in on it, it has prongs that need to line up with the front pump(main pump) inside the transmission.
You will feel and hear it click into place, there may be 2 or 3 clicks needed.
To check if it is all the way in put a straight edge across the bell housing, no part of the torque converter should touch the straight edge.
When you put the trans in place the bell housing should slide onto the dowels and be flush with the block, DO NOT use the bolts to force these together, or you will hear a BAD CLICK, the front pump breaking, because torque converter was not properly lined up.
Broke front pump mean full rebuild on trans and a new pump.
Once bell housing bolts are tight you should be able to spin torque converter to line up first bolt/nut to flexplate and spin engine to re-install the the other 3 bolts/nuts