If there is just a lunge in your animation then it depends on what type of game you make. If it’s some kind of strategy or game with “constrained” target based combat system then you can probably do everything programmably.
if (Vector3.Distance(player.transform.position, enemy.transform.position) < attackDistance)
{
StopMoving();
Attack(enemy);
}
If it’s 3D game where player fully controls every move and you want to prevent player and enemy from getting too close then you can add gameObject to your player and your enemies with collider + rigidbody and new physics layer which will collide only with itself. It won’t affect your movement and other physics stuff, but will probably give you a desired effect.
Overall it’s all specific to your game’s genre and other parts of your code, how your character move etc.