Welcome to TRS
Things that need to be considered in swapping engines to different sizes
Ford EECs(computers) are transmission specific
An EEC for automatic won't like not being connected to an automatic, CEL and idle issues
An EEC for a manual can't control an automatic
1994 and earlier used EEC-IV(OBD1) 60 pin computers, and used separate spark system module
1995 and up used EEC-V(OBD2) 104 pin computers, with spark system module in the EEC
1994 and earlier EEC-IVs can be either Speed Density systems or Mass Air Flow(MAF)
Speed Density used MAP sensor as primary air flow sensor, which is fine but didn't allow for changes in the engine
MAF systems are more flexible and better overall, most EEC-IVs were MAF by 1990 but not all
Mustang A9L EEC-IVs are a good choice for manual trans, A9P for automatic, I believe all are MAF but just guessing
1994 and earlier used speedometer cable
1995 and up used electronic speedometer
1997 and earlier used 35psi return fuel system, 2 fuel lines
1998 and up use 65psi returnless fuel system, 1 fuel line
This will be an issue with the 1999 Ranger
1998 and up Explorers had PATS(passive anti-theft system), EEC won't turn on fuel system unless PATS test is passed, correct PATS key in ignition
1999 and up Rangers had PATS, except 4cyl
PATS goes with the EEC, so replacing 1999 Ranger computer with 1996 Explorer, or 1990 Mustang, computer would eliminate PATS in the 1999 Ranger
1997 and up manual transmission(M5OD-R2) from an F-150 with 4.2l V6 will bolt to 5.0l and it's shifter location is same as Rangers M5OD-R1.
Earlier manuals from 5.0ls had shifter farther forward, and can work, new hole cut in floor and shifter arm bent to clear dash.
Automatic would need to match EECs control parameters.
The EEC-IVs would be the easiest to use wiring wise, but still transmission specific.
With EDIS-8 module for spark, or TFI distributor and module depending on EEC
EDIS module is much better to use
The 1999 Ranger uses a speed sensor on the rear axle(VSS), if Ranger has 4Wheel ABS then the ABS module gets the VSS signal converts signal for tire size and sends it out to speedo, EEC, and Cruise.
If Rear ABS then VSS signal goes to GEM module, and is converted for tire size and sent out.
GEM(generic electronic module) runs the cab electrics, wipers, windows, lights, ect..