In this paper, we propose a 3D LiDAR sensor-based costmap generation and path planning algorithm using it for reliable autonomous flight in complex indoor environments. 3D path planning is essential for reliable operation of UAVs. However, existing grid search-based or random sampling- based path planning algorithms in 3D space require a large amount of computation, and UAVs with weight constraints require reliable path planning results in real time. To solve this problem, we propose a method that divides a 3D space into several 2D spaces and a path planning algorithm that considers the distance to obstacles within each space. Among the paths generated in each space, the final path (Best path) that the UAV will follow is determined through the proposed objective function, and for this purpose, we consider the rotation angle of the 2D space, the path length, and the previous best path information. The proposed methods have been verified through autonomous flight of UAVs in real environments, and shows reliable obstacle avoidance performance in various complex environments.