Welcome to TRS
You CAN do anything
4.0l SOHC engine was used in Rangers, 2001 and up
So fitment is not an issue and parts are available
But there are a few problems
2006 Mustang used "drive by wire" so no throttle cable
2006 Mustang computer is "married" to its instrument cluster, so can't be used without it, even in another Mustang, same for 2004 and up Rangers
2WD Mustang transmission can't be used with a transfer case
3.0l 4x4 transmission won't fit the 4.0l engine
So you would need
2001-2003 Ranger 4.0l computer and engine wiring harness, + PATS key for that computer
2001-2003 Ranger 4.0l upper and lower intake and wiring
2001-2003 Ranger 4.0l 4x4 transmission, 3.0l transfer case is OK to use
And yes, exhaust manifolds as well
So CAN be done, but quite frankly a 5.0l OHV V8 swap would be easier and cheaper, and you would have something thats better than a 2001-2011 4.0l SOHC Ranger, which is what you are building, and anyone can go out and buy the factory version of