You really want to watch some tutorials on youtube from Epic Games.
When you don’t know how to use Casting, then it’s maybe too early to go fancy already.
To get the Distance between 2 actors, you need a Reference of one actor inside of the other one.
Getting references is not THAT easy. You can get them by Tracing then, getting Overlap events, spawning them and saving the reference etc.
Then, if you have a valid reference (reference variables are empty if you don’t but a real object into them), you can get his ActorLocation as well as the
ActorLocation of the first actor and then subtract them and get the length of the result.
The function you show above also still needs a valid object to be used. The Cast node does not work like that.