Teleport a mob to an armor stand when it gets too far from it

Solution 1:

The /tp command requires a target. You can remove the second /execute and move the selector into /tp instead:

/execute @e[type=ArmorStand,name=Slime] ~ ~ ~ /tp @e[type=Slime,name=KingSlime,rm=5] 62 5 18