The ONLY 4.0 swap that will be 'plug and play' will be a '90 BII 5 speed to a '90 Ranger 5 speed, both will manual windows. Ask me how I know.
Even then, I had issues with Wipers, Taillights, reverse lights, Radio.....
Nothing will be 100% plug and play. But a '90 BII to a 90-92 Ranger or a 91-93 Explorer will be easiest of all the swaps. There will always be wiring differences that will need to be sorted out. Get a wiring diagram for both vehicles and start swpping pins on the cannon plug on the drivers side firewall, there will be differences.
You swap the entire engine bay, from the cannon plug all the way around to the passenger side, through the firewall and into the computer. Swap it all over.