A pandemic is like an epidemic on steroids. Both are words for a widespread disease, but a pandemic can spread across continents, while an epidemic affects a smaller population. An epidemic disease can originate in one area but grow to be a pandemic as it infects people all over the world.

The world has seen many pandemics before, like the 1918 influenza pandemic. In 2009 the avian flu was declared a pandemic and in 2020 the spread of COVID-19 reached pandemic proportions. When a disease affects a lot of people, declaring it a pandemic helps to alert the public to its seriousness and to coordinate efforts to contain it. Here’s the word in the wild:
Many scientists see a vaccine as the only solution to the pandemic. (Nature)

The WHO declared that the virus is a pandemic. (The Verge)
An epidemic, on the other hand, affects a more localized group of people. There could be an epidemic of seasonal flu, which means that a lot of people in one area get it at the same time. Epidemic is also an adjective to describe a widespread infectious disease. Unlike the word pandemic, you can use epidemic for anything that catches on, like an unfortunate epidemic of cheating at a high school. 
"This would help prevent the re-emergence of the disease after we have brought the present epidemic under control," he said. (BBC)

More broadly, antibiotic overuse contributes to the growing epidemic of antibiotic resistance. (Scientific American)

A second project is under way to produce clones born with diabetes, another epidemic disease that affects both humans and dogs. (BusinessWeek)
Remember: a pandemic is a kind of epidemic, one that travels all over the world. A pandemic is everywhere, but an epidemic is only somewhere.