Pembrolizumab and nivolumab are both prescription medications used to treat various types of cancers, including solid tumors and blood cancers. They may be used alone or in combination with other medicines for cancers that are more advanced, have spread in the body, or are no longer responding to previous treatments.