  We study with first-principles methods the interplay between bulk and surface
Dirac fermions in three dimensional Dirac semimetals. By combining density
functional theory with the coherent potential approximation, we reveal a
topological phase transition in Na$_3$Bi$_{1-x}$Sb$_{x}$ and
Cd$_3$[As$_{1-x}$P$_x$]$_2$ alloys, where the material goes from a Dirac
semimetal to a trivial insulator upon changing Sb or P concentrations. Tuning
the composition allows us to engineer the position of the bulk Dirac points in
reciprocal space. Interestingly, the phase transition coincides with the
reversal of the band ordering between the conduction and valence bands.
