Random layers not printing in my print, they seem to be missing

Printer: Ender 5 S1
Slicer: Ultimaker Cura
Hardware: Marlin
Problem: Whenever I try printing something random layers are missing in the print. These layers are random and don’t appear on the same spots if I reprint the same thing. Sometimes the print doesn’t continue printing after that last layer and there’s just a bunch of string filament all over because the filament couldn’t stick to the previous layer, which was printed incorrectly. I attached an image of the missing layers I’m talking about.
What I tried: I tried releveling my bed, tightening all the screws, changing the bed and nozzle temperature, printing at different speeds, printing with different filaments and trying different prints.