How to connect 2 cuboids in a "T" shape
Make 2 loop cuts on the vertical shaft (Ctrl+R), bring them close to the vertices of the horizontal shaft (as Julian points out in the comments, once you accept the position of a loop cut, you can still readjust by pressing G twice), when the vertices of the two shafts are nearly touching each other (green lines on the image), select all 8 vertices (you can do it easily in Wireframe mode, press Z then W) and press M then B (Merge by distance) - the vertices should now be connected.
Remember to remove the inner face (marked red) for proper shading - you can do it easily in Wireframe mode or by hiding one of the external faces first.