When parsing initials, you're pronouncing the name of the letter and not the word itself. In your case of the NHS, when speaking/reading those initials, you don't say 'National Health Service'. Instead, you'd say 'Enn Ach Ess'. 'Enn' begins with a vowel, so you use 'an' for the indefinite article.
Your example of 'UFO' operates on the same principle, but the name of the letter 'U' begins with a long 'u' sound (i.e. it's pronounced 'yoo'), which always takes 'a' as the indefinite article, e.g. 'a union [yoo-nion] representative'. Initials beginning with a 'U' will therefore always take 'an' as the indefinite article.
So, the initials stand-in for the names they represent, but when we write them, the single-letter characters we use also stand-in the names of those very letters. It is the latter which dictates how we deal with vowel sounds.