Dilaudid is an opioid analgesic that works by blocking the pain receptors in your brain. Dilaudid can be used to treat severe pain and provide immediate relief, or it can be used as part of a longer-term treatment plan, such as after surgery or after complication from cancer.