"Sand/grain" URP Shader Artifact On Borders After % Operation

I’m tried to create a prototype grid shader with a shader graph, but after 2 days I’m here.
I’ve used a modulo node and after failing tried to create a custom node chain to get the remainder of the division, but both of them get the same bug. At the edges of cells, I got a strange “sand/grain” effect.
In theory, if one of three the world coordinates of pixel = 2, 2%1 = 0 and pixel sets to secondary color, but in practice, half of them sets in secondary color and half sets in the main color…
How to fix that?

This is unfortunately just a bi-product of floating point imprecision; points on boundaries could realistically be either part of the border or not, so the pixels flicker in and out between both states. One fix would be to add a very small offset to the input position such that any object that is perfectly aligned on any given axis will now not quite be at the boundary, but that just makes the problem less likely. Alternatively, you could use smoothstep in place of the step function with a small transition zone between section, thus acting as a form of anti-aliasing; however this would make your edges slightly softer depending on how large you set that window.