I had to do something like that for a server once which had to deal with quite a big world and lots of different enemies that all had to be able to attack each other. Now keep in mind this was not UE4 and maybe UE4 has something built in that makes this redundant:
(In your case I’m not sure if this approach would help your performance or harm it, but maybe it’ll be helpfull nonetheless. It really depends on the amount of enemies.)
What I did was seperating the world into “cells”. In UE4 it would work like this to get the current cell to the position: FVector2D(int(Pos.X/CellSize), int(Pos.Y/CellSize)); I wrote this in Squirrel which has tables where I would then add this as key and the enemy as a value (I think in UE4 you would use TMap for that). If you update this for all of your enemies regularly, instead of having to check the distance to every single enemy from every single enemy, you would only need to check a few adjacent cells (You could also let it iterate the adjacent cells until it finds a cell that is not empty, which I used to find the nearest waypoint.) Now, I’m not sure how efficient the collision-detection is, maybe that would be a better approach since this will only really have a positive impact on performance when there’s many enemies present. I had to deal with a few hundreds of them at once that all had to be able to attack each other.
Good luck in any case. Interested to see some replies on this topic myself