Detection if a GameObject is below you or next to you?

Hi,
I am wondering how you could check if a Cube was under you and if there was, do nothing, but if there wasn’t create a new cube under it until there like 50 cubes then stop?

Yes, this is very similar to MineCraft… I’m trying to understand how this is done…?

Please help!

try this

if(Vector3.Distance(OBJECTpositionOne, OBJECTpositionTwo) > Distance){

}