There are a bunch of Methods to Save Performance in Unity. One of them is not to use Vector3.Distance since its just a Wrapper around a very smple Function.
No we don’t mean that you cannot Use them. But you should try to avoid them and break down your C# Code. There are only a few Reasons why you need to Use a Else Statement. Switch should be avoided since it is a very complex Structure inside CSharp and is basicially nothing else then a if else Statement. While the Foreach Wraps around a while loop and produces extra garbage inside your Project.