M5OD-R1 for 4x4 was started in 1990 Ranger 4.0l 4x4, which will bolt up to 2.9l engine, and 1350 transfer case.
But if you already have the M5OD from a 2WD then you will need to find a 4X4 M5OD trans from any engine, and remove the tail shaft housing and tail shaft to swap on to the 2WD trans.
1350 and 1354 have the same bolt pattern for transmission mounting so that part doesn't matter.
i.e. you can replace a 1350 transfer case with a 1354 transfer case, front drive line is the only difference