If you can not seem to function in certain situations without panicking, do not worry. You're far from alone. Everyone has something they panic over. For many people, it's public speaking. For some, though, it could be water, enclosed spaces or even heights. No matter what it is, you may be able to take the edge off with something I like to call the distraction, or lucky, technique.
I call it because because it involves distraction through activities or objects. For example, if you're afraid of heights, you might try singing a song every time you climb a ladder. The song may distract you from the height problem a bit.
If you're afraid of airplanes, you might find it helpful to distract yourself by playing word or counting games. For instance, you could count how many passengers are wearing blue shirts. You could also see if you can find each letter of the alphabet on various things through the airport cabin.
The reason I call it the distraction, or lucky, technique is that you can also help yourself get over a fear by using a “lucky” object to distract you. For example, I always held my lucky quarter in my hand in high school when I had to sing in the choir. Flipping the quarter over and over in my hand helped me to focus on something else a bit.
If you can not avoid a situation, the next best thing is to make the time pass quickly and to shift your focus. So, the next time you feel panic coming on, try to think about or do something else. It may help a bit.