I had a similar sort of issue years ago with audio latency were it would slow down music, mouse movement and everything if I had other applications open. I bought new SSD's, PSU's and GPU's and all. I had electricians and all out to the house to test the sockets and they found absolutely nothing. It turned out to be my fucking paid AV ZoneAlarm, I uninstalled it and everything went back to normal, I'm now just using windows defender.
If it is latency I used this program: https://www.resplendence.com/latencymon
If it goes into the red after several tasks then there is something up and you will need to pin point the problem, it will pinpoint the program causing the latency too. For me it was software and not hardware related but it still did not point to ZoneAlarm as far as I remembered or did it , been years ago I cant remember fully. Anyway it was solved in the end after months of BS wrecking my head