NGL, I've spent a decade wondering why I couldn't sleep at night and couldn't concentrate all day, only to finally realize I was constantly low on electrolytes because of my intense exercise routine.
And if anyone is wondering, sports drinks are worthless sugary drinks shrouded in "sporty" marketing. Vitamin D, Calcium and Magnesium is what helped me (and are far more cost efficient than sports drinks). Consult a doctor.
There are low sugar sports drinks. Most of the electrolytes they're advertising is just salt. Your body needs salt to function. You lose salt when you sweat.
My doctor told me I come literally just put some table salt in water and it would do just as well as any sports drink, sugar or no.
I work in a physical environment and they hand out electrolyte packets and Gatorade like candy when it gets hot.
I make my own with a 1:1 mix of potassium chloride and sodium chloride. Throw in a dash of lime (I use a powder so i can premix.) I just add dash to my water when I need electrolytes.