My impression is that nicotine is "essentially" harmless but caffeine is actually harmless, maybe even good for you (kind of like a glass of red wine a week).
The dose makes the poison and tablets are about the only way you could overdose on caffeine. Your stomach will be telling you to stop long before you get to 40 cups, which isn’t enough for a healthy adult to overdose on.