How to create a trigger for Range?

I am making a Tank game, and I want the computer-controlled tank to only shoot when it comes within a certain range of the player-controlled tank. I tried to use a Circle2D collider, but it wouldn’t lay flat on the ground so it wouldn’t work. Tried a Sphere3D collider, and whenever I went to shoot it would just damage myself. How could I set it up to where the computer tank will only shoot within a certain range of 12-15 units?

Just use the distance formula to check how far apart the 2 objects (player tank and ai tank) are, then only shoot or go into shooting state or whatever when the distance is below a certain threshold.

Distance Formula