subtract the position of one thing from the other, this gets you the difference between the two, the vector
because we only care about the absolute value of the vector, use the…absolute value (lol) to drop the sign (we don’t know what order you did the first step, (a - b) or (b - a) wont matter if we use absolut-value
get the length of that vector
there should be nodes in BPs or commands on C++ to do this. I know there is also a Distance node or VectorLength in Materials if you are doing your maths there…