Which words are pronounced with an /ɑː/ or /æ/ depending on dialect?

What you are hearing is the infamous trap–bath split.

Some accents (like GenAmE) do not distinguish the vowels in trap and bath (both /æ/). But many BrE (RP and mainstream) and Oceanic (AusE, NZE, SAE) make a distinction. In contexts before /f, s, θ, ns, nt, ntʃ, mpl/, the /æ/ changes to /ɑː/.

So it depends on which country you’re in. Trap sounds mostly the same in AmE and BrE, but bath sounds ‘Englishy’ in BrE to Americans (and vice versa to the English).

The Wikipedia article on the phonological history of English short ‘a’ and in particular its trap–bath split article give the rule, lots of examples, and the many exceptions.