The 2004 Ranger was first year for digital dash, HEC, and CAN Bus, network between modules
Also first year for SJB, smart junction box, body computer
Only issue is the PCM and dash interface since dash needs data from the PCM to show speedo/odo, and warning lights, other modules shouldn't be an issue as far as functioning
PCM and HEC are also "married" so one won't work without the other, to prevent odometer tampering
If the 2004 is a manual transmission that would make it easier, as far as leaving PCM and HEC in place
2003 and earlier Ranger would be easier, all analog
You can of course run another PCM for 5.0l, again manual trans would be best/easier
People have done V8 swaps into 2004-2011 Ranger so it can for sure be done
I would look for those builds