Here's what you can try if your desktop device is lagging when Spotify is on the foreground:
Disable Hardware Acceleration. You can find this in the 3-dot menu > View > Hardware Acceleration.
Make sure your device is rocking the latest software updates, particularly the ones that have anything to do with graphics (for example, drivers and other software). You can refer to your device’s manufacturer for more help with this.