You need to have a spawner that will get distance from player in regular intervals. It will store it in a float variable. Each time you measure distance, compare it to another variable which holds the desired distance below which the enemy will be spawned.
Enemies can have a similar system, they measure distance from player in regular intervals, when that distance is above the desired threshold, trigge their despawn process.
It can be done in many different ways, but if you're a beginner, this is the easiest one (though not the most efficient one).
Actions you will need are Get Distance and Compare Float for measuring and comparing values. Since you are new, for now use Create Object and Destroy Object for creating and destroying enemies.