People can use codeine to relieve pain. However, doctors will usually only prescribe it for short-term relief in cases of mild to moderate pain when other, nonopioid medications have not helped. Doctors more commonly use codeine to treat a cough.