Yes, aligning the vacuum levels of the two materials that you are connecting is the first step in determining how the bands need to be modified at the interface. For the sake of convenience let me take the example metal-semiconductor interface. In this example, consider the semiconductor to be n-type. You can use the following diagram for reference:
The circles with the negative sign are electrons in the semiconductor. You can notice that in (a) the vacuum levels are indeed aligned. This physically corresponds to the materials being very far apart. Once you align the vacuum levels you can observe where the Fermi levels $E_F$ in both materials lie. When these materials are brought close to each other, the electrons will tend to flow from a higher $E_F$ to a lower $E_F$. When the materials are sufficiently close to each other this flow of electrons will occur (in this case) from the semiconductor to the metal. This can be seen in (b). At this point it might be evident why it was useful to distinguish the electrons in the semiconductor with the circles. These excess electrons in the metal (that came from the semiconductor) give rise to a negative charge on the metal at the interface. At the same time, the holes (squares with positive sign) corresponding to these lost electrons are unbalanced charges in the semiconductor. Therefore the semiconductor acquires a positive charge at the interface. Since the two materials now carry an excess charge their vacuum levels have to differ. This is why:
The work function $\phi_M$ and electron affinity $\chi$ of the metal and semiconductor respectively will not change just because the two materials are in contact. Also, the bandgap $E_g$ will be the same. Due to the exchange of charges between the two materials, these bands will bend as shown in (b). This can be justified by looking at the bending of the conduction band. Now, if the electrons in the conduction band want to go over to the metal side then they must overcome the repulsion from the excess negative carriers in the metal. In other words, they have overcome a barrier, which is exactly what the bending of the conduction band depicts. The fact that the band gap $E_g$ and electron affinity $\chi$ are constant, you can justify the bending of the valence band and the vacuum level.