When you suddenly give up caffeine after drinking caffeine a lot for years then your body will need time to adjust.
While your body is getting off caffeine and no longer has caffeine coming into the body then your body will usually get headaches, Jitters, become sleepy, tiredness and you may also become irritable.
You'll usually start to feel the symptoms of caffeine withdrawal within 2 to 3 days of stopping the consumption of caffeine.
If you're drinking caffeine and have trouble sleeping then the caffeine could be the problem.
For most people caffeine keeps you alert and awake so avoiding caffeine a few hours before bed or avoiding caffeine entirely will help you sleep.
Caffeine is okay in moderation but too much caffeine can lead to health issues.