Transcription factors function by binding to promoter or enhancer regions of DNA, thereby facilitating or inhibiting the recruitment of RNA polymerase, the enzyme responsible for transcribing DNA into RNA. This regulation of gene expression determines how cells respond to toxic agents by either activating protective pathways or leading to cellular damage and toxicity.