* Generally, 1987-2006 (and some very early 2007s): This is the broadest range where interchangeability is good. The engine itself remained largely the same, making swapping relatively straightforward.
* Computer Control Differences: The biggest potential issue lies in the engine's computer control system. Earlier models may have simpler systems, while later ones are more sophisticated. Direct swapping might require adapting the wiring harness, computer (PCM/ECU), and potentially sensors. This is a more complex mechanical task.
* Minor Internal Differences: While the fundamental design remained the same, there were minor internal updates throughout the years. These generally didn't impact interchangeability, but could influence performance slightly.
In short: While a 1987 4.0L *can* be swapped into a 2006 Jeep, you'll almost certainly need to adapt the wiring harness and computer. The closer the donor and recipient years are, the simpler the swap becomes.
Always check specifics: When planning a swap, always consult detailed engine and vehicle specifications to ensure compatibility of the mounting points, accessories (alternator, power steering pump, etc.), and the engine management system. Forums and Jeep-specific websites are invaluable resources for detailed information on specific years and models.