Celecoxib is a nonsteroidal anti-inflammatory drug (NSAID) used to relieve pain and inflammation associated with conditions like osteoarthritis, rheumatoid arthritis, and ankylosing spondylitis. It works by selectively inhibiting the enzyme COX-2, which plays a key role in the production of prostaglandins that cause inflammation and pain. Celecoxib is preferred over some other NSAIDs due to its lower risk of gastrointestinal side effects such as ulcers and bleeding.