The enemy must actually fully end its turn there
The Scout Rogue's Skirmisher feature states:
You can move up to half your speed as a reaction when an enemy ends its turn within 5 feet of you. This movement doesn't provoke opportunity attacks.
The section on "The Order of Combat" states:
4. Take turns. Each participant in the battle takes a turn in initiative order.
It is agreed upon that one's turn ends just before the next person in the initiative order's starts.
But if that were not clear the "Your Turn" section lists what you can do on your turn:
On your turn, you can move a distance up to your speed and take one action...
You can take only one bonus action on your turn...
Other Activity on Your Turn
You can communicate however you are able, through brief utterances and gestures, as you take your turn...
You can also interact with one object or feature of the environment for free, during either your move or your action...
Because these all happen during/on your turn, your turn can only end after you have done these things (or will not do any more of them).
If the developers had wanted the feature to activate at another time they could've used the phrase "When an enemy ends its move within 5 feet of you" or "When a creature enters a space within 5 feet of you". Their wording makes the feature only activate at a turn's end, which is after the enemy has potentially attacked you.
The benefit of this feature is that it allows you to get away from an enemy without provoking opportunity attacks using your reaction whereas normally a Rogue would have to take the Disengage action (using either their action or Cunning Action feature). This leaves both your bonus action and action available for other things.
The feature also provides a significant amount of movement which does not subtract from the rest of your movement for that turn.