For the sake of clarity, the term
unitID specifically refers to unit tokens like
target,
mouseover, and
player, and these are used by the various Unit functions to get information about them.
OP keeps using the term to refer to something that is not a unitID, and it's unclear what they do have and what exactly they're trying to do with it.
There are many ways to get information about what's targeting you, but how you do it depends on what you need it for. Are they players or npcs, are they in the open world or in a battleground, do they have nameplates, etc.
This is also almost
the exact same question that was asked a week ago by someone trying to make a nameplate addon for a private server.
If you are the same person let me save you some time. Burning Crusade came out 10 years ago. The API has undergone drastic changes since then; nobody here can help you develop an addon for an outdated version of the game simply because the differences between the codebases are too great.