This paper experimentally compared and analyzed the efficiency and effectiveness of three algorithms—A*, RRT*, and Particle Swarm Optimization (PSO)—to address the challenges of path planning and obstacle avoidance for unmanned aerial vehicles (UAVs) in a 3D urban environment. Experiments across six scenarios, varying city map sizes, altitudes, and obstacle densities and sizes, revealed that the A* algorithm performed best in terms of computational efficiency and path quality. The PSO algorithm was suitable for tight turns and dense environments, while the RRT* algorithm, using a random approach, demonstrated balanced performance across all experiments.