Change the values in the two Constant Material expressions to 512 and 4, and then connect the nodes in the configuration shown below. The distance at which the texture blend occurs is controlled by the first Constant that is plugged into the Divide Material expression (set to 512 in the example image). The Material graph shown below provides all the logic needed to blend textures based on distance.