How do I replace blocks around me as I move?

Just put in a Repeating Command Block set to Always Active or in a Ticking function, the following command.

execute at <selector eg @p> run fill ~-5 ~-5 ~-5 ~5 ~5 ~5 <what block you want to replace with> replace <what block you want to replace>

This will replace any blocks that are x with a block that is y in a 10x10x10 box using z entities' location as the center. Make sure to change the entity selector to whatever you want, and the blocks to whatever you want. The selector @p selects the nearest player.

How it works

The execute at part runs the fill command at the entity's position who was selected with a selector. The ~'s in the fill command is used for using the run location as coordinates and you need one for each coordinate. The number after the ~'s is used for taking the run location and adding that number to it. There is a point where the volume of the fill box is too high that the command won't execute. That number is 32,768, which it isn't that high in terms of filling areas.