Also check your speed, i was having an issue with shifted layers on my “y” axis and it ended up being the speed was set too high and would cause the stepper to skip steps.
I had a problem problem like this, for me it was a continuous shift to the left of the x axis. Sometimes it was better and sometimes worse, printing speed had a small influence (slow speed = less leaning to the left), but I couldn’t get rid of the shift totally. I checked everything with the machanics, disassembled and reassembled everything. I switched the x/y steppers and even the stepper drivers boards. I replaced the x stepper wires and used a cable chain. I searched the Internet for a solution but sadly found only some posts like this with no answer in the end.
additional filtering can only work in same cases and even a change in cable length can make this not working. I would suggest to switching the cables for shielded ones, but where should the shield be connected to?
For me the following solution worked: reroute the stepper cable inside a cable chain coming from the back of the case. And route the endstop cable from the front (where LCD is sitting).