2001-2012 Ranger 4.0l SOHC is what you need.
1997-2010 Explorers use the 4.0l SOHC as well, I believe
In any case you should swap your current intake and accessories to next engine so no wiring changes are needed.
You probably have a skipped timing chain for the no compression part.
This was a common failing in early SOHC engines, new replacement parts fixed it.
A used engine is a unknown factor, you could end up buying a new problem.
I would first see if you can ID your engine's issues and see what it would cost to fix those issues.
And just FYI, a "guaranty" on a used or even new engine bought online isn't worth much.
They don't cover installation or removal costs if they even agree to replace the engine, usual response is "you installed it incorrectly, so guaranty/warranty doesn't apply"
Local wrecking yards or shops are your best bet for used/rebuilt engines.
Last edited by RonD; 08-06-2014 at 09:15 AM.