In a single reaction step, pyrimidine derivatives (4a-p) were synthesized from the triple reaction of aromatic aldehydes (1), ethyl cyanoacetate (2), and some guanyl hydrazone derivatives (3a-n). These compounds were tested as in vitro against two types of cancerous cell lines, namely, a human colon cancerous cell line (DLD-1) and a human breast cancerous cell line (MDA-MB-231). According to the obtained results, nearly all the compounds have cytotoxic activity in the tested cell lines. Especially, the compounds 4j, 4k, and 4n had a significant effect against DLD-1. Furthermore, compounds 4g, 4m, and 4o exhibited lower IC50 values compared to other synthesized compounds against MDA-MB-231. We hope that these compounds can be improved as anticancer agents in the future. Molecular docking was performed according to both topoisomerase I and N-acetyltransferase 1 proteins to examine theoretically the binding mode and site of pyrimidine compounds having the best activity.