Generally speaking to avoid BSOD you must upgrade from one Intel or AMD CPU a few generations up to am Intel or AMD CPU. If you mix Intel with AMD you are asking for trouble. For example an Intel Pentium 4 running Windows XP can be safely migrated to an Intel Dual Core or even a 2nd or 3rd generation Core CPU. Then you go to 7-8 generation. Certainly directly from Pentium 4 to 8th generation wouldn't work. After every upgrade you must install the chipset drivers of the new system, then the graphics and then the rest. Make sure all drivers are properly installed before migrating to a newer system.
You could try deleting the PCI device in Device Manager and shutdown before moving the disk to a newer system. This is the core device that all other devices are connected, so in theory Windows will install new drivers to match the new hardware without a BSOD. But if Windows cannot find drivers for some device (especially one of the motherboard), then you are risking a BSOD. I just updated the old system as much as possible before moving to a new system. Most of the times I was lucky and I didn't had a BSOD. The same is true for Windows XP, 7, 8, 10 and 11. The newer Windows version the more drivers they include so they can tolerate more hardware changes, but don't push your luck. Trying to move Windows 11 from a dual core CPU to a modern CPU is not likely to work, especially if you go from Intel to AMD or vice versa.