If it's an H.O. (don't remember off hand when they started), probably anything from 92(91?) up to probably 97-99 would go in without too much grief. I think it was 2000 that they deep-sixed the distributor, but I haven't a clue whether that would affect the electronics.
If it's a non-HO, I'd go for as close to your MY as you can get - minimize any wiring changes. Also, if you're talking a boneyard non-HO, it may be wise to change out the fuel injectors before firing it up - I've seen stories on this and other boards about those Renix-era injectors causing problems underthe hood as they age...
Also, if you keep your wiring/electronics, virtually any 4.0 will drop in, if you don't mind a couple of minor mods along the way (e.g. coolant temp sensor, etc)
Of course, if you're looking for plug and play (no modifications required), stick with your model year - this would ensure that all the wiring/sensors/electronics/etc would be the same.
Can't help much on the tranny question, but at a guess (which I wouldn't trust any farther than you can throw your rig!), I'd say it shouldn't matter. Of course, if one of the more experienced members should chime in with different info, they're probably more right than I am.
Keep in mind that I'm shooting from the hip here - never swapped an engine, so I'm kinda regurgitating what I've read here. Try a couple of searches as well - you'll probably find better/more accurate info that way. But at least this should start the ball rolling.
Rob