The 4.0 is a great engine, but it doesn't really require the beef of a ZF5. Other things to consider are the fact that the ZF has a different pattern from the 4.0, and the ZF is already a really tight fit in the Ranger.
If (big if) you can find/get an adapter plate to make it happen you still need a body lift, custom drive shafts, not sure what you will do with the T-case.
Might be better to grab an M5OD, throw it in there for now, gather parts for your ZF swap, and then once you have the ZF parts together and working sell the M5OD again.