DDR4 won't fit in a DDR5 slot, and vice versa.

Correct. The physical notch is in a different position, so you can’t even jam it in there without breaking things.

That’s by design. Each generation runs on a different voltage and signaling standard. DDR3 is 1.5V, DDR4 is 1.2V, DDR5 is 1.1V and uses on-die ECC. The motherboard’s memory controller is built for one type. Mixing soldered and slot RAM of different generations isn’t just a “won’t work” – it’s a “won’t fit and could fry something.”

If you have a laptop with soldered DDR4 and an empty slot, you need a DDR4 SODIMM. Same generation, same speed ideally, but at least same generation. The notch is the hardware guarantee.

This is not where you get creative. Buy the right one.