Factors affecting enzyme activity include temperature, pH, substrate concentration, enzyme concentration, and the presence of inhibitors or activators. Pepsin works best in an acidic medium, with an optimal pH of around 1.5–2.5, while trypsin works best in an alkaline medium, around pH 8.