87-91 if you are using the intake and parts off of your motor (because these are TBI) and 92-95 are a direct bolt in swap.
There are newer years that will work as well up to 04, but everything has to be changed on them because they are an OBD2 motor and would require OBD1 sensors to match with your computer. But the bare block on them are the same as what you have.
'87 YJ, 4.2L built and bored, 8" of lift, 8.8 rear, AX15/NP 231J, Tom Woods drive shafts, Flat fenders, 12,000LB winch, Custom bumpers, Rattle can paint job. Never completed...