The indefinite articles [a type of adjective] a and an indicate a noun that is one of many. Some grammar books refer to them as "noun markers." That is, a common noun that is not specified as a certain one is preceded by a or an. When, for example, a person asks for "a pencil," it does not matter which pencil the person has, just as long as it is a pencil that works, probably (one of many). However, if a person asks for "the pencil," he or she refers to a specific pencil, not just any one. The article the, therefore, is termed a definite article.
In determining the use of an as opposed to a, whenever the noun that the article modifies begins with a vowel, or a vowel sound--e.g. an original idea, an hourly rate--Standard American English calls for the use of an. While there are some exceptions such as in the phrase, a unique experience, the noun that the indefinite article modifies begins with a cosonant or a cosonant sound, Standard American English calls for the use of a--e.g. a glorious sunset.
In terms of how you use them in a sentence, there is no difference between these two words. They are both indefinite articles that are used to refer to something that is not already known to the people who are talking. So, in other words, if I say "I saw a cat" it means that you and I don't already know what cat I'm talking about.
As far as the difference between the two, the only difference is that "a" is used before words that start with a consonant sound and "an" is used before words that start with a vowel sound. So we would say "a cat" but "an eagle." We would also say "an hour" because that word sounds like it starts with an "o" rather than an "h."
an is used for the 5 unconstant letters like:a,o,i,e,u , but notice the first letter in the word must be pronounced exactly like the constant i mean for example: an umbrella, but a uniform . we also say an hour although the letter h is not from the constant letters but the it is pronounced as the first letter is a so it takes an ,but we say a horse. thats all its very simple.