Cooperative communication is a key technology to improve the stability of UAV swarm communication. To reduce the energy consumption in cooperative communication, this study proposes a method for selecting relay nodes based on distance and energy constraints. First, a two-stage communication model was designed to explain the signal forwarding communication process. Subsequently, cluster head nodes were filtered through a competition mechanism to be used for forwarding source signals. The minimum communication capacity of the link contained the distance parameter of the relay link. Lastly, under energy and distance constraints, the optimal solution of the minimum interrupt function for the cluster head was found, and was defined as the best relay node. The experimental results show that the two parameters of network coverage and residual energy of the improved method were higher than those of other mainstream algorithms. Furthermore, the actual UAV networking test results show that the proposed relay selection method had the most residual energy. It is concluded that the relay selection method proposed in this study has good practicality and advancement in UAV cluster communication.