The increasing popularity of unmanned aerial vehicles (UAVs), commonly known as drones, in various fields is primarily due to their agility, quick deployment, flexibility, and excellent mobility. Particularly, the Internet of Drones (IoD)—a networked UAV system—has gained broad-spectrum attention for its potential applications. However, threat-prone environments, characterized by obstacles, pose a challenge to the safety of drones. One of the key challenges in IoD formation is path planning, which involves determining optimal paths for all UAVs while avoiding obstacles and other constraints. Limited battery life is another challenge that limits the operation time of UAVs. To address these issues, drones require efficient collision avoidance and energy-efficient strategies for effective path planning. This study focuses on using meta-heuristic algorithms, recognized for their robust global optimization capabilities, to solve the UAV path-planning problem. We model the path-planning problem as an optimization problem that aims to minimize energy consumption while considering the threats posed by obstacles. Through extensive simulations, this research compares the effectiveness of particle swarm optimization (PSO), improved PSO (IPSO), comprehensively improved PSO (CIPSO), the artificial bee colony (ABC), and the genetic algorithm (GA) in optimizing the IoD’s path planning in obstacle-dense environments. Different performance metrics have been considered, such as path optimality, energy consumption, straight line rate (SLR), and relative percentage deviation (RPD). Moreover, a nondeterministic test is applied, and a one-way ANOVA test is obtained to validate the results for different algorithms. Results indicate IPSO’s superior performance in terms of IoD formation stability, convergence speed, and path length efficiency, albeit with a longer run time compared to PSO and ABC.