Most breast and prostate tumors are hormone-dependent, making it possible to use hormone therapy in patients with these tumors. The design of effective endocrine drugs that block the growth of tumors and have no severe side effects is a challenge. Thereupon, synthetic steroids are promising therapeutic drugs for the treatment of diseases such as hormone-dependent breast and prostate cancers. Here, we describe novel series of steroidal pyrimidines and dihydrotriazines with anticancer activities. A flexible approach to unknown pyrimidine and dihydrotriazine derivatives of steroids with selective control of the heterocyclization pattern is disclosed. A number of 18-nor-5α-androsta-2,13-diene[3,2-d]pyrimidine, androsta-2-ene[3,2-d]pyrimidine, Δ1, 3, 5(10)-estratrieno[16,17-d]pyrimidine, and 17-chloro-16-dihydrotriazine steroids were synthesized by condensations of amidines with β-chlorovinyl aldehydes derived from natural hormones. The synthesized compounds were screened for cytotoxicity against breast cancer cells and showed IC50 values of 7.4 μM and higher. Compounds were tested against prostate cancer cells and exhibited antiproliferative activity with IC50 values of 9.4 μM and higher comparable to that of cisplatin. Lead compound 4a displayed selectivity in ERα-positive breast cancer cells. At 10 μM concentration, this heterosteroid inhibited 50% of the E2-mediated ERα activity and led to partial ERα down-regulation. The ERα reporter assay and immunoblotting were supported by the docking study, which showed the probable binding mode of compound 4a to the estrogen receptor pocket. Thus, heterosteroid 4a proved to be a selective ERα modulator with the highest antiproliferative activity against hormone-dependent breast cancer and can be considered as a candidate for further anticancer drug development. In total, the synthesized heterosteroids may be considered as new promising classes of active anticancer agents.