How to auto merge faces?
Use Extrude Manifold tool (instead Extrude) just select front face and move forward with Snap to Vertex ...

... than move it up.

Since faces around becomes non-plannar and internally a triangulation happens in unexpected direction it is better to search for Quads to Triangles operator (that does tris in shorter distance) ...

... or you can use Knife tool to triangulate manually by longer edge.