Purpose Stigma is a major impediment to human rights in health care that causes discrimination, isolation and the exclusion of individuals from essential health-care services. It fosters fear, leading to negative stereotyping of individuals based on their social, cultural or health status and undermines their dignity and respect, consequently violating their right to health. Therefore, the purpose of this study is to evaluate the moderating role of psychological flexibility in the relationship between stigma (enacted, anticipated and internalized), mental health and the quality of life of substance users. Design/methodology/approach This study was based on a cross-sectional design and included 200 male patients with an age range of 18–65 years from 23 rehabilitation centers in four cities in Pakistan. The purposive sampling technique was used, and the sample size ranged from 4 to 23 participants for each site. Four scales were used to measure stigma, general mental health, quality of life and psychological flexibility in substance users. Findings The data were analyzed using SPSS and Smart PLS, which showed that stigma (enacted, anticipated and internalized) had a detrimental effect on substance users’ mental health and quality of life. Additionally, psychological flexibility acts as an efficient moderator between them. Originality/value This research unveils the moderating role of psychological flexibility in mitigating stigma’s adverse effects on individuals with substance use disorders. Future investigations should prioritize interventions aimed at enhancing psychological flexibility to ameliorate the repercussions of stigma, ultimately enhancing the well-being and quality of life of substance users.