Best way to give enemy/ally AI tracking? (2D Top down)

Hi, I’ve been trying to make a 2D top-down space dogfighting game and am currently in the process of making some basic AI for my allies and enemies. I want the AI to start tracking the nearest game object that belongs to the opposing faction when they enter a certain range around the AI. Since I want the battle to be on a large scale, with dozens of ships on the map, what would be the most efficient to accomplish this? Currently, I’m using tags to keep track of the factions

Typically this is accomplished with a trigger collider on a child GameObject. You can check the tags of the things that enter/exit the trigger in OncollisionEnter/Exit. Look into layer based collisions too.

So from what I understand, what you mean is to give the AI-controlled ship a Collider2D, probably a circle collider, that extends out in a set radius around the ship and set it as a trigger. Have the AI script check the tags of whatever that enters/triggers the circle collider to determine whether it should start tracking or not?

Currently, I’ve put the factions on its own layer such that there is no friendly fire or collision, (enemy cannot interact with enemy etc.)

Precisely.