The easiest swap would be from a 93 or 94 Ranger.
1). You'll need a complete wiring harness from a 93 or 94 4.0 Ranger. This means the on-engine and compartement harness. Every bit. The explorer's engine compartment is set up differently. It would be a nightmare to try and fit it to your Ranger. Also.....best to use the proper harness for the proper 4.0/auto, or 4.0/MT combo.
2). A 93-94 Explorer or 4.0 ranger PCM. Best that you get a Manual Tranny PCM when using a MT, but you can use a AT PCM. The biggest difference is fuel injector idle down strategy. But you can't use a MT PCM for a AT, as the MT PCM would lack the proper Torque convertor lockup info, etc.
3). It's once again best to get an engine from a 93-94 4.0 Ranger or Explorer. Intake to oil pan. The have the proper sensors and set 90-92 are slightly different and 95-97 are quite a bit different. If you must get a 90-92 4.0, you'll need to swap injectors from a 93-94 4.0. As they changed from a "needle" pintle to a disc pintle style of injector in 93'. But the rest is the same....engine wise.
4). Exhaust: Manifolds will be needed of coarse. You will need a y-pipe from the same years. A 90-92 only uses one HO2S. A 93-94 will use 2. A 95-97 y-pipe has a different flange to catalytic convertor. The fatherest back you should have to replace is to the catalytic convertor. Everything further back should interchange.
5). There are even a few little differences between 93 and 94's. In 94 they started producing 4.0's with CPS's and EGR's. If your donor engine has either of these, then you need a PCM and harness that match. Some 94's have one or the other, both or neither. All depends, but another reason why everything should be taken off the same donor truck.
6). Transmission: You need a A4ld or M5od-r1 from a 4.0 Ranger or Explorer. The Auto's can be gotten from a 90-94 4.0 vehicle and the M50d-r1's can be had from just about any year of 4.0 truck.
6). Other things that may need attention or be obtained are fuel lines, air intake, radiator, and engine mounts.