Detecting multiple gameobjects

So, I have a collider on my enemy gameObject. What I want it to do is when any gameObject with a specific Tag enters, it store it in an array.

And then I want to get the enemy to find the closest gameObject that is in the array, set it to it’s target and walk towards it and attack bla bla bla. But then if the target gameObject is still in the collider, but another gameObject happens to be closer, then switch the target and chase that one instead.
(the whole walking towards and attacking is just so you know the “big picture” of what i’m trying to do, but okay with doing that myself, heh).

I know how to Compare Tag, so if it was only one gameObject I was “attacking” it would be fine. But storing multiple gameObjects that have entered the collider and keep checking if the “target” is the closest one, then if not switch target.

And then to finish it off, if one of the gameObjects leaves the collider, then remove it from the array.

Maybe i’m over thinking this and I don’t need an array( or list), and there’s a simpler way to do this? I’m not too sure.

Any help or a point in the right direction in doing this would be great.

SphereCast/OverlapSphere/iterate over Find…Objects, any of the comments should prove to be a solution, just posting a recap to have an Answer provided.