As you know there is a distance expression, its asking for 4 values: x1, y1, x2, y2.
Every sprite has a x and a y position, The distance expression helps determine the distance between two sprites.
So for example if you want to see if the player is near the wall using distance you can do something like this:
add a system.compare 2 values event.
Then on the top value do something like this but with the objects you want to compare:
distance(Player.x, Player.y, Enemy.x, Enemy.y)
then add a if less or = to 100, that will see if the player is within a distance if 100 to the player, Then add your other events/actions to do what you need to do
Let me know if you need anymore help