Connect Overlapping Faces/Verticles
We don't know a lot about your topology, but you could try this way: Select your top cube, then click Face > Intersect (Boolean), then change the Operator box setting to Union. You may need to make some adjustments like Remove Doubles (Merge by Distance in 2.8) or draw some edges with knife (or J to join vertices).