3.0l is from a different family, so unlike a 2.9l to 4.0l swap you will need to get a transmission with the 4.0l, also wiring harness and computer.
Ranger or explorer shouldn't matter, most use explorer donors to get the V8(5.0l)/trans. and wiring with computer.
If '94 Ranger is "tired"(not sure what that means), then you might better spend your $ on selling that truck and then putting the money you would spend on a swap into a Ranger with a factory 4.0l
Unless you have done it a few times before engine swaps generally cost you 2 times whatever you budget for, there can be a lot of nickel and dime stuff that adds up to $, and in the end you end up with a truck that is worth less if you go to sell it, if you will keep it forever then a swap can make sense, but not cents, lol.