<p xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">Following the development of the unmanned aerial vehicle (UAV) industry, the number of UAVs has increased significantly, and higher expectations regarding the effect of spatial path planning have been expressed. Traditional coordinate-based conflict detection and path planning methods of UAVs are highly complex and have low computational efficiency. While the conflict detection method based on the grid system can improve efficiency, the rigid grid structure of the existing local grid system or discrete global grid system is insufficient. Since the rigid structure only encodes grid cells, multiple or different size grids are required to identify UAVs in motion, further complicating path planning. The main contributions of this article are as follows. First, we proposed a nonrigid hierarchical discrete grid structure and coding method for spatial three-dimensional grids and grid data model. This method can accomplish the aggregation of any adjacent eight grids to form multiple nonrigid structures, making the original fixed relationship between parent and child grids more flexible. Second, the nonrigid grid structure optimizes the identification ability of grid vertices, grid edges, and grid faces. It has eight times the identification ability of the rigid grid structure. We exploited this structure for UAV identification with the same size grid at any position of the grid structure. Third, based on the nonrigid grid structure, an improved UAV conflict detection method and path planning method are designed. Experimental results indicate that, on an average, the efficiency of the improved conflict detection is an order of magnitude higher than that of the traditional computational detection method. The improved path planning method reduces the path length by an average of 11% compared to the single-grid planning method, and is 3.85 times more efficient than the multi-grid buffer planning method.