We find a novel confinement mechanism in the two-flavor dense quark matter proposed recently, that consists of the 2SC condensates and the P-wave diquark condensates of d-quarks. This quark matter exhibiting color superconductivity as well as superfluidity is classified into two phases; confined and deconfined phases of vortices. We establish that the criterion of the confinement is color neutrality of Aharonov-Bohm (AB) phases: vortices exhibiting color non-singlet AB phases are confined by the so-called AB defects to form color-singlet bound states. In the deconfined phase, the most stable vortices are non-Abelian Alice strings, which are superfluid vortices with fractional circulation and non-Abelian color magnetic fluxes therein, exhibiting color non-singlet AB phases. On the other hand, in the confined phase, these non-Abelian vortices are confined to either a baryonic or mesonic bound state in which constituent vortices are connected by AB defects. The baryonic bound state consists of three non-Abelian Alice strings with different color magnetic fluxes with the total flux canceled out connected by a domain wall junction, while the mesonic bound state consists of two non-Abelian Alice strings with the same color magnetic fluxes connected by a single domain wall. Interestingly, the latter contains a color magnetic flux in its core, but this can exist because of color neutrality of its AB phase.