Project vertices on edges
Here we go :
Before anything, I used your .blend file as the reference.
Start off by adding in a plane and add in about 10 loopcuts.
Select the bottom edges and extrude it along the X-axis and select the end edges and use the shear tool to make that slanting edge.Tweak it a little bit(I didnt select the last vertex before extruding, to match your mesh.)

Select any vertex in the subdivide portion of the mesh and Use the proportional editing tool to match the mesh to imperfect one.Do a some tweaking and you'll get this:

Select the edges as shown in this image...

Extrude it downwards and scale in it on the z-axis by S
+Z and 0

Now extrude it on the x-axis again to make the base. Now you have the mesh with perfect topology. However you might have to flip the normals of certain faces with Alt+N &gt;and flip Normals.

Don't delete your previous mesh. Use it as the reference to make this mesh (just like retopologizing)