Synthetic polymerization and supramolecular polymerization with sequence control is far from an easy task. Herein, a narcissistic self-sorting supramolecular polymer is prepared with a sequence of (−AA−BB−)n by using cucur-bituril (CB)-based ternary complexes as supramolecular monomers, which are spontaneously formed from starting materials of heteroditopic AB-type guest and CB. The process of supramolecular polymerization and their structural changes at each stage of polymerization have been successfully demonstrated by NMR, UV-Vis and fluorescence spectra. The self-sorting starts from the second step of polymerization after the formation of different ternary complexes as supra-monomers. The dynamic supramolecular interactions and the thermodynamic stability of the host–guest complexes are found to be the crucial factors to drive the sequence control of the supramolecular polymers. Furthermore, the water-soluble supramolecular polymer is red-emissive, which can serve as fluorescent sensor to detect morphine in artificial urine with considerable stability, sensitivity and accuracy. And it can also distinguish heroin and morphine, which are two kinds of opioids with similar structures.