I suppose there is a chance it could work if they are both Triton engines. The 2004 has a different version of the engine than the 98. Compare them and see.
Easiest way is to go to a parts website and plug in both vehicles. If both part #'s come back it will be a fit.
Search Ford F-150 Questions
Ford F-150 Experts
Related Models For Sale