joining objects

How can I join 2 objects so I won’t get bug like that (second picture)




the wireframe still exists on the second one (picture after joining) but it seems like only inside of the mesh is rendered