Evidence on the association between selenium and liver function parameters is limited and controversial. Data on dietary selenium intake, blood selenium concentration, and liver function parameters were obtained from the National Health and Nutrition Examination Survey (NHANES) 2017-2020. Associations between selenium (dietary intake and blood concentration) and liver function parameters [alanine aminotransferase (ALT), aspartate aminotransferase (AST), the ALT/AST ratio, gamma-glutamyl transferase (GGT), and alkaline phosphatase (ALP)] were assessed using multivariate linear regression models. Subgroup analyses and interaction tests were conducted to examine differences in associations according to age, gender, body mass index (BMI), diabetes, and physical activity. The study included 6,869 participants after screening. The multivariate linear regression model revealed that dietary selenium intake was positively associated with ALT (β = 0.112, 95% CI = 0.041, 0.183) and the ALT/AST ratio (β = 0.002, 95% CI = 0.001, 0.004) after adjustment for covariates. Results of blood selenium concentration also showed that higher blood selenium levels were positively associated with ALT (β = 0.436, 95% CI = 0.308, 0.564), AST (β = 0.112, 95% CI = 0.015, 0.208), and the ALT/AST ratio (β = 0.012, 95% CI = 0.009, 0.015). However, ALP decreased with increasing blood selenium concentration (β = -0.207, 95% CI = -0.414, -0.000). In addition, we found significant differences in the effect of selenium on liver function parameters according to age, gender, and BMI. Dietary selenium intake and blood concentration affect liver function parameters. These findings suggest that further research is needed to explore these associations to promote liver health and disease prevention.