Grid based building system

You could set collision boxes for each grid and detect collisions for the object, but then that would create conflicts as 4 collisions would be triggered at the same time. To detect which grid is the object closer to, you can cast a line trace from the object straight down to the ground, detect the grid that it returns as the hit result and locate the object there when you release the dragging input key.