If the word following begins with a vowel sound, the word you want is “an”: “Have an apple, Adam.” If the word following begins with a consonant, but begins with a vowel sound, you still need “an”: “An X-ray will show whether there’s a worm in it.” It is nonstandard and often considered sloppy speech to utter an “uh” sound in such cases.
The same rule applies to initialisms like “NGO” (for “non-governmental organization”). Because the letter N is pronounced “en,” it’s “an NGO” but when the phrase is spoken instead of the abbreviation, it’s “a non-governmental organization.”
When the following word definitely begins with a consonant sound, you need “a”: “A snake told me apples enhance mental abilities.”
Note that the letter Y can be either a vowel or a consonant. Although it is sounded as a vowel in words like “pretty,” at the beginning of words it is usually sounded as a consonant, as in “a yolk.”
Words beginning with the letter U which start with a Y consonant sound like “university” and “utensil” also take an “a”: “a university” and “a utensil.” But when an initial U has a vowel sound, the word is preceded by “an”: it’s “an umpire,” “an umbrella,” and “an understanding.”
Reference: www.brains.wsu.edu