The model years I would not recommend are 2001-2002 for cracked 0331 head issues, and 2005-2006 due to the possibility of not easily cured problems with the oil pump drive assembly, and the possibility not easily cured of automatic transmission software issues.
If you decide on an automatic as I always strongly recommend if you intend to do lots of offroading on more challenging trails, I'd go for a 1997 to 2002 which has the awesome 32RH automatic transmission. For a 5-speed, the 1997-99 has the very good AX-15 transmission. Then came the not quite as good 5-speed NV3550, then came the not quite as strong 6-speed NSG370.
In summary if I were buying a another TJ I'd buy a 1997-1999, or a 2002-2004. I Ioved my previous (stolen) '97 and my present '04.