There is no best way because "AI" is a too broad subject.
So far i've been doing simple AIs, they were almost always based on a state machine idea in mind.
I had a script with a state
variable, then I execute a different _process
function based on that state. In any given state, if some condition is met (player seen, player escaped, took damage...) I change the state variable to go to another behavior in reaction to what happened, so the AI can start running after the player, escape, or go back to patrolling.
There are more complex ways to do AI such as behaviour trees, genetic, and algorithms such as pathfinding are often useful when implementing them (Godot has pathfinding utilities for that, like Navigation2D
as you said, or the AStar
class).