Caffeine is a natural alkaloid capable of stimulating the central nervous system (CNS): by blocking the binding of adenosine to its receptors, caffeine is capable of preventing the onset of sleepiness and promoting alertness. It is rapidly absorbed through the bloodstream and reaches peak levels in around 30 minutes. The effect of caffeine can last for few hours and can take up to one day to fully eliminate it from the body. 
Some people experience sleep disorders and anxiety if they consume caffeine. In addition to that, this natural substance can induce drug dependence if consumed every day, so instead of blocking the intake directly, it is better to gradually reduce the used amount.
Although caffeine may help beat drowsiness, this effect is only temporary and doesn’t replace a good night sleep.
The Michigan State University Sleep and Learning laboratory performed a scientific research on a group of 275 participants to assess if caffeine could be beneficial to face sleep deprivation. The study was based on the ability to perform simple tasks and challenging “placekeeping” tasks, in which was necessary to achieve assignments in a specific order without making errors or step repetitions.
It turned out that caffeine only partially helped against a raugh sleep night: sleep deprivation impaired both type of tasks and caffeine helped just to perform simple tasks but, could not improve the performance of “placekeeping” tasks.
Even if caffeine helps to stay awake, it is not a valuable solution to avoid procedural errors and it will not help in performing higer-level tasks.
Because sleeping disorders increased during the pandemic, and lack of sleep can also impair immune system, the findings of this research hilight the importance of a good sleep hygiene and confirm that caffeine is just a palliative for tiredness and not the solution to it. 
References: https://www.sleephealthfoundation.org.au/caffeine-and-sleep.html  https://www.sciencedaily.com/releases/2021/05/210526115549.htm