How to find distance between two points in a point cloud file

You can use .onBeforeCompile() of PointsMaterial to modify it.
In general, I do it this way:

let uniforms = {
    uniform1: { value: new THREE.Vector3(0, 1, 2) }
}

let m = new THREE.PointsMaterial({
    size: 0.1, 
    onBeforeCompile: shader => {
        shader.uniforms.uniform1 = uniforms.uniform1;
        shader.vertexShader = `
        uniform vec3 uniform1;
        ${shader.vertexShader}
        `.replace(
            `old_part_of_code`,
            `code_with_modification`
        ) // modify vertex shader
        shader.fragmentShader = `...`; // modify fragment shader 
    }
})

... // somewhere later in the code
uniforms.uniform1.value = _new_value_;

Not a very simple example, but the first I recalled: Petals 2020 (for NY contest)