It is best to have a custom tune done to accommodate the extra displacement of the 5.4.
You should be able to use the 4.6 MAF as any competent tuner can adjust for it. It is always best to discuss this with your tuner.
The 97-98 99 4.6 uses a 2 wire knock sensor. The 97-98 5.4 has 3 wires of which one is a ground for the shield. Both have a Yellow /red wire to pin 57 on PCM.
1997-98-99-2000-01 Yellow/red to 57 on PCM 4.6 Same for 5.4.
97-98 Pin 91 feeds power for 4.6 and other components. Same for 5.4
1999- 2000-01 Pin 32 for power. Same for 5.4
2002+ Cannot confirm.
Some engines have 8 rib serpentine belts and some have 6. Be sure to check so that your accessories have the correct pulley.
PATS (Passive Anti-Theft System) :
The 1999 model year saw the introduction of the PATS as standard equipment on the F-150. If you try to use the PCM from a PATS equipped truck (1999 +) on a non PATS equipped truck (1997-98) you will run into wiring problems. The instrument cluster in PATS equipped vehicles communicates with the PCM and they share security data. The work as a pair and if you use a different PCM they will need to be reprogrammed to work together. For a PATS capable PCM to function in a Non PATS vehicle the PATS function in the PCM must be disabled. So a 1999+ 5.4 PCM in a 1997-98 truck will need to have its PATS disabled. 1999+ 5.4 PCM in a 1999+ 4.6 Truck will need to have the PCM configured to the 4.6 instrument cluster or have the PATS disabled.
Both engines use the same engine mounts and their location on the block are also the same so your old ones will fit. Unbolt and place aside the AC and PS. You need to remove the intake manifold for the engine to come out. Yes there are 3 bolts on the starter.