If I sweat a lot while hiking and don't replace the salt/electrolytes, I have a terrible time sleeping, even at home in my regular bed.
For years, I thought my problem was dehydration, so I drank lots more water. That made things worse - not only did I have to pee several times per night, the extra water was taking more salt out of my system.
Now I make sure to take salty foods on the trail, and add electrolyte capsules (SaltStick Caps Plus) for hot weather. Makes a big difference for me!
Some nights I can't sleep from the aches and pains of being out-of-shape. If it's bad enough, I'll take plain Tylenol.
I don't want to take antiprostaglandins (aspirin, ibuprofen, and naproxen). Prostaglandins cause pain, but they also signal your muscles to get stronger - "no pain, no gain" is true for me. Tylenol (acetaminophen, paracetamol) is not an antiprostaglandin.
Some people like Advil PM or Tylenol PM to help sleep. The "PM" is Benadryl (diphenhydramine), which makes most people sleepy. Not me, Benadryl keeps me awake at night.
I can't sleep on thin foam pads any more. Short Therm-A-Rest 40th Anniversary Edition pad works for me, and it's much warmer.