I recently had a panic attack and now every time I drink any caffeine my heart starts pounding and hurting?

Get medical eval. The fact that there is a direct connection between caffeine and the symptoms is a good reason to get an evaluation as soon as possible by a physician. Anxiety caused symptoms that might resemble these would most likely cluster around stressful situations. There is no good reason to not get an expeditious medical assessment.
Stimulant. Caffeine is a relatively potent stimulant, and as true with all stimulants, it can cause palpitations and a rise in one's heart rate. Should one experience multiple palpitations and/or an elevated heart rate for a prolonged period of time, be sure to see your physician.