M5OD transmissions have an integrated bell housing so you will need an M5OD trans from a 2.3l Duratec Ranger RWD, 2001 or newer
Rangers used 2.3l/2.5l Lima SOHC engines prior to 2001, in 2001 Rangers got the more powerful 2.3l Duratec DOHC engine, these engines are unrelated so their transmission are not interchangeable.
You also need the Flywheel from 2.3l Duratec engine, I think starter motor is the same but you need to check that.
Automatics use Flexplate to power torque converter
Manuals use Flywheel to power clutch
Starter motors engage the Ring gear on the outside edge of flexplate or flywheel, on some models the ring gear is at a different depth or height, so starter motor model is different.
Just look up the replacement part, if there are different part numbers then you will need to change starter motor, wiring will be the same.
You also need manual transmission computer or have your computer software changed to manual, this also effects the PATS(passive anti-theft system).
Automatic computers need to be hooked up to the transmission or they will report a problem, CEL comes on all the time.
Not sure about the drive shaft length.