The wiring is not an issue. All you have to do is take the electrical parts off of your current engine and move them to the donor engine, and everything will work just like it already does. You do not need to go looking for engines with compatible electronics; you will be disposing of that stuff.
In terms of physical engine compatibility, the closer you stay your current generation the easier it will be. The further you get from your current generation, the more work will be required. Some of the work is desirable (some improved components) some of it less so.
If your 92 is fully stock, the most direct swap will be another 91-95 XJ engine. All of the brackets and emission parts are the same (the AC compressor changed in 93 but the bracket is the same). I think the YJ HO and the ZJ 4.0 engines are basically the same in terms of brackets and bosses but I don't know for sure.
96-99 XJ engines are very similar but the power steering bracket and the belt tensioner assembly is different. They are superior to the 91-95 setup, but you have to swap the power steering pump too since its also different. The A/C bracket is different but you can bolt your old bracket onto the block. 97-up do not have the hole for the temperature gauge sender anymore either, so you would have to find somewhere else to put the sender (not a big deal but its a difference). 99 has the curved intake manifold that some people prefer. TJ and WJ changed to the newer 4.0 layout in 99; I am pretty sure that the 96-98 is essentially the same as ours.
'00-01 XJ engines have the coil rail ignition, which is more work. However you have to swap the ignition parts anyway so its not that big of a deal. The exhaust ports on the head changed again too and there are some problems getting older headers to line up from what I have read. Also the heads have problems with cracking. The TJ and WJ 4.0 engines in this period are not compatible.
Going backwards, the 87-90 XJ engines can also be made to work if you strip them all the way down. They have very different accessories (alternator, etc) but you can make yours fit with some effort. I have even heard of people putting the 4.2 Wrangler block under the 4.0 head for a mini-stroker. More work, keep in the 91-99 years for maximum simplicity
Everything electronic has to be kept the way it is now, and some of these little parts changed every couple of years, so unless you get another 92 then you need to keep all of the sensors, fuel injectors, and ignition parts (including distributor, coil, CPS, etc) that you have now and move them to the donor. Components from the other years won't interchange correctly unless you can find proof that they will. Injectors changed very often, temperature sensors changed, CPS changed, etc.
The fuel plumbing and return is specific to your vehicle, so you will have to keep the fuel rail and parts you have now and move them to the donor engine.
You also have to watch for things like the throttle body assembly, which changed a few times. You'll probably just move yours over instead of trying to adapt your sensors to work on the newer style. This kind of stuff is what you run into, but it's entirely doable.
I put a 99 XJ engine into my 91 and it was pretty simple.