It is simple to adapt the previous code to have an NPC try to maintain a constant distance from a target object. It involves always moving toward a point that is runAwayDistance away from the target, regardless of whether this point is toward or away from the target.
Just remove the If statement in the Update() method:
void Update() {
Vector3 targetPosition = targetGO.transform.position;
float distanceToTarget = Vector3.Distance(transform.position, targetPosition);
FleeFromTarget(targetPosition);
}
However, with this variation, it might be better to have the method named something like MoveTowardsConstantDistancePoint() rather than FleeFromTarget(), since our NPC is sometimes fleeing and sometimes following.