Are you using the internal audio? That sits in an electrically noisy box, probably without a metal "can" over that part of the circuit board, and so it picks up that noise. Nothing you can do about that, except to use an external audio device that connects digitally to the computer.
And get a *good* external device! The cheap ones are just a wrapper around the same chip that is designed to sit inside the noisy box, and so their performance is not that great.
---
Even if you do use an external device, you can still have a ground loop. Digital is indeed (mostly) immune to that (if the ground loop noise gets really bad, digital "just doesn't work"), but if there's an analog part of the signal path *anywhere*, the analog noise will get in at *that* point.
I had a laptop that used the built-in USB connection of an otherwise analog sound board, and it had a high-pitched "warble" that depended on what the laptop was doing. Even moving the mouse was enough to change it.
Unplugged the laptop from the wall so it was running on battery, and it immediately went away. Plugged it back in, and it came back. Classic ground loop, even if it sounds different. It was picking up a switching power supply in the laptop, instead of the usual raw AC power and all of its "dirt", and getting into the analog output of the built-in USB sound card.
The solution was a USB isolator. NEVER BREAK A SAFETY GROUND!!!
I looked at off-the-shelf USB isolators, got sticker shock, and made my own custom circuit board around a chip that does that entire job. Problem solved!
---
Now I have a similar problem with a different rig. It's low enough to not be a pressing issue - easily managed with a noise gate in OBS - but I do have some 1:1 audio transformers to put on the analog side, once I finish a few other projects to replace the function that they're doing now. That rig uses the aux outs of an X32 to feed a USB line-in, because the X32's USB connection is tied up with the sound guy's multitrack.