While scientists have long noted a connection between a person’s addiction to opiates, called “opioid use disorder,” and chronic pain, the brain mechanisms linking the two are poorly understood.