This article establishes a novel generic and platform-agnostic risk-aware path planning framework that is based on the classical $D^*$ lite planner with a path design focus on safety and efficiency. The planner generates a grid map where the occupied/free/unknown spaces are represented with different traversal costs. As it will presented, in this case, a traversal cost is added to the unknown voxels that are close to an occupied one. The algorithmic implementation is also enhanced with a dynamic grid map that has the novel ability to update and expand during the robotic operation and thus increase the overall safety of the mission and it is suitable for exploration and search and rescue missions. On the generated grid map, the $D^*$ lite is able to plan a safer path that has a minimum traversal cost. The proposed path planning framework is suitable for generating 2D and 3D paths, for ground and aerial robots respectively and thus in the 3D case, the grid is created with one voxel height to plan for a 2D path, which is the main factor that differentiates between 2D and 3D path planning. The efficacy of the proposed novel path planning scheme is extensively evaluated in multiple simulation and real-world field experiments on both a quadcopter platform and the Boston Dynamics Spot legged robot.