If you are wanting to use a tile set for your game, then a tilemap would probably be easiest. The tiles automatically snap to set x and y positions based on the desired tile size. If you are just wanting to snap anything to a grid, then you can use a simple formula to round it.
round(n/32)*32
In this example n is the number you want to snap, and the grid size is 32x32, but you can obviously change that to whatever size you want it to be. :)