Aiming at the problems of obstacles and failures in multi-UAV (Unmanned Aerial Vehicle) formation flight, a dynamic formation switching and reconfiguration method was proposed. For a certain UAV in the formation, the obstacles and other UAVs in formation were regarded as dynamic threats. By adaptively adjusting score weights considering different flying scenarios, the ability of the UAV formation to avoid obstacles in dynamic environment was improved. When one UAV in the formation occurs faults, the remaining UAVs were formation reconfigured. By changing the positions of the followers relative to the leader in the objective function of the dynamic window approach, a new formation without the fault UAV was reconfigured. By this means, fault-tolerant formation could be obtained. Simulation results show that the proposed formation obstacle avoidance and reconfiguration algorithm can realize dynamic obstacle avoidance and fault-tolerant formation flight in the case of one UAV fault or lack of power. At the same time, compared with the traditional method, the distance error between the UAVs in the formation is lower.