Although ERCP is generally safe, it does carry some risks, such as pancreatitis, infections, bleeding, and perforation of the gastrointestinal tract. The risk of complications is higher in cancer patients due to the complex nature of their disease and the potential for involvement of multiple organs.