Many of us learned an incomplete version of using a and an when we were kids, a version that left out a critical word: sound.
It’s almost impossible to say it wrong, but we often just look at the words we’re writing, and if a word starts with a consonant, we’ll put a before it. But if you were to say it out loud, you wouldn’t do it; your ears would hear the inconsistency. Your tongue would trip over itself.
Use a before nouns beginning with a consonant sound:
a unicorn, a horse, a master’s degree, a law degree
Use an before nouns beginning with a vowel sound:
an upset, an hour, an MBA, an LPGA event