It does depend on the sound of the word, which is why I added 'vowel sound' or a 'hard sound'.

UNBC - that starts with a "y" sound, so "a" is correct. ("y" is a vowel only "sometimes" - remember memorizing the vowels in the early grades? )

And "hour" does start without the H sound, so "an" goes with that.

LOL - I remember "An Halibut". Eric the Half-A-Bee! (Half-An-Bee??? )