* Engine Mounts: While the general engine bay dimensions are similar, the engine mount locations might be slightly different. You'll likely need to adapt or replace engine mounts.
* Wiring Harness: The 2002 engine's wiring harness will almost certainly be incompatible with the 1997's system. You'll need to either swap the harness or extensively modify both harnesses to make them work together. This is a very significant undertaking.
* Computer/ECM: The engine control module (ECM) is also different and will require significant modification or replacement. A 2002 ECM won't work with a 1997 wiring harness, and vice-versa.
* Sensors: Sensors and their locations might differ slightly.
In short, while the engines are both Vortecs and generally similar, the swap is far from straightforward. It would require significant mechanical and electrical expertise, and likely custom fabrication. It's a project best suited for experienced mechanics. It would be much easier to find a used 1997 Vortec engine.