People understandably get hung up on the social/legal status of caffeine, but I think there's nothing intrinsically wrong with the notion of a DUI charge for it. In several important ways it acts like a milder form of cocaine or amphetamine, and with high enough doses it can cause similar behavioral problems ("tweaking", paranoia, mania, even psychosis).
In a small segment of the population, a few cups of coffee may be enough to cause mild forms of the mentioned symptoms. But this is more of a genetic anomaly / over-sensitivity.
In an "average" adult, it would require a lot of caffeine to trigger these symptoms -- dozens of cups over a very short period of time. Caffeine pills or powder would be a far more likely explanation. And yeah, driving after popping a significant number of caffeine pills is probably as dangerous as driving after ingesting a small dose of cocaine. TBF if the caffeine concentrations were such that this were a likely explanation, I bet we'd be hearing about it.
At one point, I got a large coffee, about 20oz, from a shop in San Marcos, TX. After finishing it over 15 or 20 minutes, I found myself with a full on stimulant overdose: dizziness, sweating, confusion, irritability, shaking... It took me a couple of hours before I would have felt safe driving.
I am a caffeine addict, at about a pot per day at the time of this story.