How could I add collision based offset to the "set world location"?

How could I stop the blocks from going through the ground and other blocks when building? I use linetrace and set world location to determinate the location currently.

What about a sphere trace or box trace?