Airplane AI 2d

Hello, I have had complications making an AI that is capable of regulating itself (according to its difficulty), I need an AI that is capable of following the player without crashing into it, essentially the AI of a plane but in two dimensions, that is, it cannot rise or descend, what I want to know is how I could implement an AI that in the first instance when seeing the player starts his chase, being at a certain distance can mark him and shoot, and in case the AI is the prey, can dodge the missiles or shots