Here’s what Apple says about how it works.
We have very little trouble with this for the most part. Our HomePods pick up (correctly) on most commands. The only time we have trouble is when one of us is actively using an iPhone and it hears the command instead of the HomePod.