CDK inhibitors function by binding to the active site of CDKs, preventing the phosphorylation of target substrates required for cell cycle progression. This inhibition can lead to cell cycle arrest at G1 or G2 phase, ultimately inducing apoptosis in cancer cells. The specificity and efficacy of these inhibitors depend on their ability to target specific CDKs involved in carcinogenesis.