I was watching DS9 just now and it occurred to me: apparently in the future they have solved the problem of people having the same name. When talking via communicator you never hear "Sisko to Smith" and two different people try and respond. We've all worked in the place with two Bens or three Steves and there is confusion, but not in Starfleet.
The only logical conclusion is that the Federation assigns everyone a unique forename and surname at birth. Either that or you cannot be admitted to Starfleet if they have someone with your surname already.
I would argue its better explained by ai being able to.infer who is meant even if more than one person has that name. Whichnisnpretty trivial to do well.
Think of it another way if we the viewers can infer from a single name who thry are referimg to ao could an advanced ai that sees and hears all