The latest 5G mobile networks have enabled many exciting Internet of Things (IoT) applications that employ Unmanned Aerial Vehicles (UAVs/drones). The success of most UAV-based IoT applications is heavily dependent on artificial intelligence (AI) technologies, for instance, computer vision and path planning. These AI methods must process data and provide decisions while ensuring low latency and low energy consumption. However, the existing cloud-based AI paradigm finds it difficult to meet these strict UAV requirements. Edge AI, which runs AI on-device or on edge servers close to users, can be suitable for improving UAV-based IoT services. This paper provides a comprehensive analysis of the impact of edge AI on key UAV technical aspects (i.e., autonomous navigation, formation control, power management, security and privacy, computer vision, and communication) and applications (i.e., delivery systems, civil infrastructure inspection, precision agriculture, search and rescue operations, acting as aerial wireless BSs and drone light shows). As guidance for researchers and practitioners, the paper also explores UAV-based edge AI implementation challenges, lessons learned, and future research directions.