Caffeinated coffee does not appear to increase the risk of cardiovascular disease and cancers, according to Harvard T.H. Chan School of Public Health researchers, who reviewed a large body of evidence. They found that consumption of three to five standard cups of daily coffee may, in fact, reduce the risk of several chronic diseases, including type 2 diabetes, cardiovascular disease, and certain cancers. 
However, keep in mind that one should avoid adding sugar or artificial sweeteners. Try to swap them with stevia or monk fruit extract. They are both plant-based and contain zero calories. If you like adding milk to your coffee or tea, use unsweetened plant-based milk or a splash of cow's milk.
If you prefer teas with flavorings, check how much additives they contain. The best would be to avoid such teas while on a diet and use simple leafy or green/black teas with no preservatives.
According to the T.H. Chan School of Public Health researchers, "Although caffeine has long been thought to have a diuretic effect, potentially leading to dehydration, research does not fully support this. The data suggest that more than 180 mg of caffeine daily (about two cups of brewed coffee) may increase urination in the short term in some people but will not necessarily lead to dehydration." It means that caffeinated beverages, including coffee and tea, when used in moderation, can be counted in the total daily water intake. , 
 Coffee, 2020. https://www.hsph.harvard.edu/nutritionsource/food-features/coffee/.
 Killer S., Blannin A., Jeukendrup A., (2014) https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3886980/.