Pyrimidine analogs function by substituting natural pyrimidines in DNA or RNA synthesis. This substitution can disrupt the replication and transcription processes, leading to cell death. For instance, in cancer cells, which have a high rate of division, these disruptions can effectively halt tumor growth.