A is used as an indefinite article before a noun beginning with a consonant sound. An is used similarly before a vowel sound. This follows local pronunciation and how concerned you are with someone being wrong on the internet.
In the US, herb is pronounced without the preceding h. An American would write an herb. In the UK, the h is pronounced, so there one would write a herb. U is pronounced with a y sound before it, so I say a union. I would also say an onion.
The last time I was Canada I noticed both pronunciations. I also haven’t heard anyone say a hour (h-our) with the h enunciated.