Multivariate analysis identified G allele (OR = 0.15, <i>p</i> = 0.040) and antitumor therapy (OR = 0.10, <i>p</i> = 0.027) as protective against anxiety, while breakthrough pain (OR = 6.65), higher pretreatment NRS scores (OR = 2.80), and depression (OR = 61.03) were risk factors (all <i>p</i> < 0.05).<h4>Discussion</h4>Our study indicates that G allele carriers exhibit lower anxiety levels, suggesting a certain correlation between the OPRM1 gene polymorphism and anxiety in cancer pain patients. Here, OPRM1 is linked to depressive disorder.