The A/AN rule, which you should know, says that it depends on whether or not the word following A/AN STARTS with a vowel sound.
UNIFORM is pronounced "YOO-nih-form", which starts with a consonant sound, the "Y", which is pronounced as a consonant ("Yuh") not a vowel. So it's "A UNIFORM".
OFFICE starts with a vowel sound, so it's "AN OFFICE".