Hello!
A good nights sleep is something one has to work upon. Physical, psychological and social issues can be potential causes of persistent poor sleep at night which in turn can affect these very domains leading to a vicious cycle. Simple but continuous lifestyle modifications, addressing of physical ailments of any and finally professionally prescribed medicines are the usual management options. And yes tea/coffee or any food or stimulant beverage is not advisable just before going to bed.
Next Steps
Try to practice something as simple as Sleep Hygiene. Get professional advice from a psychiatrist or psychologist. You can reach me at Practo online consultation