I’m going to give you the answer but I’m also going to explain why it’s the answer. And you’re definitely on the right track!
When you do something like MyBot.Location - Enemy.Location then that results in a new vector between those two points: MyBot.Location and Enemy.Location.
If you want to use easy static FORCEINLINE functions for this you can use FVector::Dist() and FVector::DistSquared()
But Neil is definitely explaining to you more of how it all actually works
/**
* Euclidean distance between two points.
*
* @param V1 The first point.
* @param V2 The second point.
*
* @return The distance between two points.
*/
static FORCEINLINE float Dist( const FVector &V1, const FVector &V2 );
/**
* Squared distance between two points.
*
* @param V1 The first point.
* @param V2 The second point.
*
* @return The squared distance between two points.
*/
static FORCEINLINE float DistSquared( const FVector &V1, const FVector &V2 );
The key point to note is that (MyBot.Location - Enemy.Location) is a FVector, which is because each of the MyBot.Location and Enemy.Location are FVector. So their difference is an FVector as well. Now when you call FVector::Size() on an object of FVector as follows (MyBot.Location - Enemy.Location).Size(), what you get is a float quantity which represents the length of that FVector.
Just know that FVector::Size() takes a square root, which traditionally is slow. A good rule of thumb is to use FVector::SizeSquared() and compare those values unless you absolutely need to know the real distance.
You can always do the following for readability.
if (DistVector.SizeSquared <= (MyDist * MyDist))
And that is typically faster than the Size() itself.