Your question is much too vague to give a useful answer. If you are expecting a full on "plug and play" swap for the motor AND transmission then the short answer is "stick to the same model year as the donor".
TONS of people have swapped the 4.6 motors in a crap load of combinations. But the swap depends upon keeping the electronics of the HOST car.
Add to this is the PCM and the tune it contains. If trying to retain the PCM as well, then the advice for sticking to the same MY goes double. Putting a PCM from a 2003 into a 1999-2000 will have issues such as no AC.
Putting a PCM into a 98 and older is not really practical because of the HUGE differences in the base electrical of the cars.
Note about PATS. Remember unless you want to have PATS re-programmed keep the cluster and PCM together.
The more restrictive swap may be the transmission. The 98 and older Mustangs uses a VSS sensor. The 99+ uses an OSS sensor. The sensors are NOT compatible to each other. The sensor used must match what the PCM is expecting and the transmission wiring harness.
There are also differences in the automatic transmission between 04, 03, and 99-01. The differences can be over come with some re-wiring and tune.
This will depend upon the exact model year combination, the exact parts swapped, and the amount of re-working you are willing to do. Recommend getting a full set of wiring diagrams for the donor and host model years so that the differences can easily be compared.
Just wondering WHY? Have you wrecked the donor?