In addition to what @Crictoli said, you could also handle it locally depending on what it is. If it’s a UI or some form of interaction system, you should handle it locally instead of constantly checking on the server. This will also cause it to be much faster as it doesn’t take into account ping or anything.
Your best attempt is to use RunService, since this not relies on rendering you should not use RenderStepped. (Forgot you said server, but still RunService is what I recommend)
I believe that in the end, these two would be running rapidly as either of the two parts would always be moving. If I did a .wait(), there’d be a time period where the script WOULDN’T work if, for example, the player and the part touched.
You won’t need to worry about performance of distance checks unless you’re literally doing thousands of them per frame. Don’t stress, go make your game
Roblox servers can easily handle doing hundreds of distance checks every single frame. This is easy to test. My shipped games make heavy use of this, and so do many others. Don’t give bad advise.
The reality is you can do what the OP asked for roughly 1,000,000 times per second, or about 16,000 times a frame (60fps) on a roblox server. I have benchmarked it.
You’re making the situation sound much worse that in is by telling them they need to worry about optimizing that.