Should I go back to work while still taking pain medication?

Generally No. Many narcotic pain medications can make you drowsy, so going back to work while taking them may be dangerous. However, if it is a non-narcotic pain reliever such as ibuprofen, you should have not limitations on work activities.
Back to work. This decision only you and the employer can make. In the us for a doctor to certify that you can work while taking pain medication (opioids) opens him to possible legal issues. In my practice patients are told not to drink, drive or operate machinery while being on opioids.