USB-C is so outrageously bad in this regard. I have a smartphone on my desk, connected via USB3 for debugging. At some point it started reconnecting if I just slightly touch the phone or cable, which is extra fun if it happens mid-deployment.
I have no working usbc-usbc cables right now. It's wild how quickly mine go bad and most of the time they're just plugged into a phone once a day (driving), if that.
I just have a drawer full of dead cables with some sort of usbc end..
Another thing is not drinking caffeine AT ALL. My sleep quality got much better after I stopped drinking coffee. Strangely I can drink as much tea as I want but coffee makes me sleep badly.