Path search is designed to find a path by traversing the state spaces from the initial state to the target state. Given enough memory and run time, the A* algorithm can find an optimal solution, but it expends much time to distinguish similar paths. Therefore, many scholars have proposed variants of the A" algorithm that find a suboptimal solution to speed up the searching efficiency. In this paper, the A* algorithm is improved and a new anytime dynamic heuristic search algorithm (ADHS) is proposed. It can find a solution quickly and then continuously optimize the quality of the solution to find the suboptimal solution until the end of time. The ADHS includes two stages, in the exploration stage, given an arbitrary cost bound, the solution is quickly obtained; in the update stage, where no setting parameters are required, reuses the previous search results. According to the cost of the latest solution, the dynamic weight factor w is introduced, which is half of the error between the current cost bound and the current solution. The next cost bound is dynamically adjusted, and the suboptimal solution is output. We tested the performance of the ADHS on the grid maps, and the experiments demonstrated that the performance of the ADHS was better than other algorithms.