How can I make my game detect whether an array of actors exist in world space ?

So to keep it simple since I don’t have that much experience, I have 8 Y float values in an array and want to check whether an actor has been assigned to any of the Y values (I want to do this for every single value in that array). If an actor has been assigned to that Y value > set a (variablename) bool to true and to not allow another actor to overlap it and be assigned to the same value, but be assigned to the next closest Y value. How will I be able to accomplish that?

(Sidenote : I have also thought of maybe using line traces to accomplish that rather than booleans).