Participants should be excluded if they have had prior treatment with an anti-PD-1, anti-programmed cell death ligand 1 (PD-L1), anti-programmed cell death ligand 2 (PD-L2), anti-CTLA-4 antibody, or any other antibody or drug specifically targeting T-cell co-stimulation or immune checkpoint pathways; prior immune modulating therapy including vaccines may be eligible; prior immune events must be evaluated and the risk for new events which may represent continued sub clinical disease or a new process at previously damaged site or immune potentiation (e.g. ipilimumab followed by IL2 causing bowel perforation, ipilimumab followed by indoleamine 2,3-dioxygenase [IDO] inhibitor resulting in clinical hypophysitis); please keep in mind that inflammatory events may occur weeks to months following the last dose of ipilimumab and possibly nivolumab; assessment of potential effects of prior therapy should include:\r\n* Immune status\r\n* Organ damage\r\n* Risk of autoimmunity\r\n* Immunopotentiation Must have received prior treatment with a CPI in the locally advanced or metastatic urothelial cancer setting. A CPI is defined as a programmed cell death protein 1 (PD-1) or programmed death-ligand 1 (PD-L1) inhibitor. Patients who received CPI therapy in the neoadjuvant/adjuvant setting and had recurrent or progressive disease either during therapy or within 3 months of therapy completion are eligible. No prior therapy with ipilimumab or nivolumab, or any agent targeting programmed cell death 1 (PD-1), PD-L1 or cytotoxic T-lymphocyte-associated protein 4 (CTLA-4) Fresh tumor tissue available for cellular characterization and programmed cell death protein 1 (PD-L1) status. Has a tissue sample adequate for programmed death-ligand 1 (PDL1) testing as determined by central laboratory testing prior to study allocation. Have received any previous systemic therapy (including investigational agents) targeting PD-1/programmed cell death ligand 1 (PDL-1) or PD-1/PDL-2 signaling pathways (including previous participation in Merck MK-3475 trials). Prior treatment with olaratumab is allowed. Prior therapy with other immune checkpoint inhibitors, including but not limited to, anti-CD137 antibody or anti-cytotoxic T-lymphocyte-associated antigen-4 (CTLA-4) antibody, is not permitted. Patients who were treated with chemotherapy, radiotherapy, immunotherapy or any investigational therapies, if eligible, must have been completed at least 4 weeks or at least 5 half-lives (whichever is shorter, but no less than 3 weeks) before the study drug administration, and all AEs have either returned to baseline or stabilized. Prior therapies targeting PD-1, programmed death-ligand 1 (PD-L1), or PARP is exclusionary (See Exclusion Criterion 5). Prior therapies targeting PD-1, programmed death-ligand 1 (PD-L1), or PARP. Prior treatment with PD-1 and programmed death ligand (PD-L)1 inhibitors Can provide either a newly obtained or archival tumor tissue sample for intra-tumoral immune-related testing and for anti-programmed cell death (PD)-1 For solid tumors other than melanoma, (in Part 4 or 5 [dose confirmation only]), participants must have a malignancy that is incurable and has either: (a) failed prior standard therapy, (b) for which no standard therapy exists, or (c) standard therapy is not considered appropriate by the participants and treating physician. There is no limit to the number of prior treatment regimens, but prior treatment(s) should not include compounds targeting programmed cell death 1 (PD-1), PD-1 ligand 1 (PD-L1), BRAF, or mitogen-activated protein kinase (MEK). Treatment must end at least 4 weeks prior to randomization. Has received prior systemic anti-cancer therapy including investigational agents or has used an investigational device within 28 days prior to the first dose of study treatment. (Notes: Participants must have recovered from all AEs due to previous therapies to ?Grade 1 or baseline. Prior exposure to immunotherapeutics is allowed, including programmed cell death-1 (PD-1) and programmed cell death-ligand 1 (PD-L1) inhibitors, provided the participant did not experience ?Grade 3 drug-related toxicity on monotherapy with a PD-1 or PD-L1 inhibitor. Confirmed tumor programmed death?ligand 1 (PD-L1) evaluation as documented through central testing of a representative tumor tissue specimen One prior disease progression episode on or after vascular endothelial growth factor (VEGF)-targeted treatment (for example, but not limited to, sunitinib, sorafenib, pazopanib, cabozantinib, bevacizumab, axitinib, vatalanib, AV951/tivozanib) administered for the treatment of RCC. Prior programmed cell death protein 1 (PD-1)/programmed death-ligand 1 (PD-L1) treatment in addition to 1 prior VEGF-targeted treatment is allowed. Previous treatment with atezolizumab or another programmed death-1 (PD-1)/PD-L1 inhibitor Treatment with an investigational agent within 4 weeks of starting study treatment or prior treatment with a checkpoint inhibitor (cytotoxic T-lymphocyte-associated protein 4 (CTLA-4), programmed cell death protein 1 (PD-1) or programmed death ligand 1 (PD-L1) antibodies). Prior treatment with clusters of differentiation (CD) 137 (CD137) agonists or immune checkpoint blockage therapies, anti-programmed death protein-1, anti-program death-ligand 1, mitogen-activated protein kinase (MEK) inhibitor Prior VEGF targeted therapies for renal cell carcinoma (RCC) including adjuvant or neoadjuvant treatments; in phase 1 only, one prior therapy with high dose IL-2 or anti-programmed cell death (PD)-1 compound alone or in combination with cytotoxic T-lymphocyte-associated protein 4 (CTLA-4) targeting drug is allowed on the trial Tumor tissue that demonstrates programmed cell death ligand 1 (PD-L1) expression in ? 50% of tumor cells (tumor proportion score [TPS] ? 50%) as assessed by immunohistochemistry at a central laboratory. Programmed death ligand 1 (PD-L1) expression on ? 1% of tumor cells by validated immunohistochemistry assay Patients must have no prior exposure to immune-mediated therapy, including anti- cytotoxic T-lymphocyte protein 4 (CTLA-4), anti-programmed cell death 1 (PD-1), anti–programmed cell death 1 ligand 1 (PD-L1), or anti–programmed cell death ligand 2 antibodies, excluding therapeutic anticancer vaccines Any previous treatment with a programmed cell death protein 1 (PD1) or programmed cell death ligand 1 (PD-L1) inhibitor, including durvalumab Patients who have previously received prior pembrolizumab or programmed cell death 1 ligand 1 (PD-/L1) blockade therapy; adjuvant interferon alpha (IFN-a), is allowed if last dose was received at least 6 months of starting study treatment Has experienced grade 3-4 intracranial toxicity (hypophysitis or CNS toxicity) with either prior intracranial radiation, anti programmed cell death-1 (PD-1), or cytotoxic t-lymphocyte-associated protein 4 (CTLA-4) inhibitor therapy Any number of previous treatments with the exception of previous inhibitors of programmed cell death 1 (PD-1), PD-L1, or programmed cell death 1 ligand 2 (PD-L2); other prior systemic therapies must have been administered at least 2 weeks before administration of pembrolizumab; the exception to this is ipilimumab which must have been administered at least 4 weeks prior to the start of pembrolizumab; patients are not required to have had prior systemic therapy Prior treatment with immune therapy (including but not limited to cluster of differentiation [CD]137, OX40, programmed cell death [PD]-1, PD-L1 or cytotoxic T-lymphocyte antigen 4 [CTLA4] inhibitors) Prior immunotherapy with programmed cell death 1 (PD1) inhibitor (i), programmed cell death ligand 1 (PDL1)i, anti-cytotoxic T-lymphocyte-associated protein 4 (CTLA4) or vaccines is allowed No anti-cancer therapy (chemotherapy, biologic therapy, or immunotherapy) in the 3 weeks prior to the T cell infusion (and all hematologic effects have resolved); no prior immunotherapy with checkpoint blockade (i.e. anti-programmed cell death 1 [PD1] inhibitor, programmed cell death ligand 1 [PDL1] inhibitor or cytotoxic T-lymphocyte-associated protein 4 [CTL4] -antagonist or similar agent) in the 6 months prior to the T cell infusion (and all clinically significant related side-effects related must be resolved) Has experienced a dose limiting toxicity on treatment with either prior radiation or anti programmed cell death 1 (PD-1) or programmed cell death 1 ligand 1 (PD-L1) inhibitor therapy Any number of previous treatments with the exception of previous inhibitors of programmed cell death 1 (PD-1), PD-L1, or programmed cell death 1 ligand 2 (PD-L2); other prior systemic therapies must have been administered at least 2 weeks before administration of MK-3475 with the exception of bevacizumab which must have been administered at least 4 weeks prior to MK-3475; patients are not required to have had prior systemic therapy; the exception to this is patients with NSCLC who test negative for PD-L1 expression or are unevaluable for PD-L1 expression must have received prior platinum-based chemotherapy for entry into cohort 2\r\n* Note: ipilimumab treatment should have been administered at least 4 weeks prior to the start of MK-3475 Patients receiving anti programmed cell death protein 1 (PD-1) immunotherapy such as pembrolizumab or nivolumab, or human cytotoxic T-lymphocyte antigen 4 blocking antibody such as ipilimumab should wait 8 weeks before Melphalan/HDS treatment. Part 1b: Must have documented confirmed disease progression on a prior programmed cell death-1 (PD-1) pathway targeted agent or must be PD-1 pathway-targeted treatment naïve. Received or ineligible for platinum-based therapy and Programmed death receptor-1 (PD-1)/programmed death-ligand 1 (PD-L1) therapy Prior exposure to any agent (approved or investigational) that blocks the programmed cell death-1 (PD-1)/PD-L1 pathway. Part 1: Has received prior therapy with cancer vaccines, or compounds targeting programmed cell death ligand 1 (PD-L1), PD-L2, cytotoxic T-lymphocyte-associated protein 4 (CTLA-4), or Mitogen-activated protein kinase (MAPK)/Extracellular signal-regulated Kinase (MEK). Any number of prior therapies (including none). For subjects who have received prior systemic treatment with cytotoxic T-lymphocyte-associated protein 4 (CTLA-4), Programmed death 1 (PD-1) and/or Programmed death-ligand 1 (PD-L1) therapy, the last monoclonal antibody administration should be no less than 6 weeks prior to start of this protocol therapy and all prior side effects must have resolved to grade 1 or less by the time of the start of this protocol therapy. Previous treatment with a programmed death 1 (PD1), programmed death-ligand (PD-L1), or cytotoxicT-lymphocyte-associated protein 4 (CTLA-4) inhibitors, or any form of immunotherapy for HCC. Availability of a representative tumor specimen from a site not previously irradiated that is suitable for determination of programmed death-ligand 1 (PD-L1) status via central testing Patients may have had prior systemic therapy in the adjuvant setting (e.g. interferon, BRAF, or mitogen-activated protein kinase [MEK] agents); patients may have had prior anti-cytotoxic T-lymphocyte antigen 4 (CTLA-4) in the adjuvant setting, if at least one year from last dose of treatment has passed prior to beginning treatment; patients may not have had any prior programmed cell death (PD)-1/PD-ligand (PD-L)1 agent in the adjuvant setting Any previous treatment with an anti-programmed cell death 1 (PD1) or PD-L1 inhibitor, including MEDI4736 NSCLC patients who have received prior therapy with an agent directed at PD-1, PD-L1, or programmed cell death 1 ligand 2 (PD-L2) Prior treatment with immune-modulatory agents including, but not limited to: interleukin (IL)-2, cytotoxic T-lymphocyte antigen 4 (CTLA)-4 blockade, programmed death (PD-1)-1/programmed death-ligand 1 (PD-L1) blockade, cluster of differentiation (CD)40 stimulation, CD137 stimulation with the exception of INF-alpha given as adjuvant treatment for high-risk, surgically resected melanoma Subjects may have received any number of the following therapies: cytokine therapy (e.g. high dose interleukin-2) or checkpoint inhibitor therapy (e.g. anti-programmed cell death [PD]1/programmed cell death ligand [PDL]1, anti-cytotoxic T-lymphocyte-associated protein [CTLA]4) or mechanistic target of rapamycin (mTOR) inhibitor therapy (e.g. everolimus, temsirolimus) Patients who have previously received ipilimumab, programmed cell death 1 (PD-1) inhibitors or programmed cell death-ligand 1 (PD-L1) inhibitors are excluded Subjects who received prior adjuvant therapy for melanoma will not be excluded (including, but not limited to, interferon, ipilimumab, limb infusion/perfusion, or use of investigational agents in the adjuvant setting) with the exception that prior adjuvant therapy with inhibitors of programmed cell death 1 (PD-1) or programmed cell death ligand 1 (PD-L1) is not allowed. However, if the subject received adjuvant therapy, the subject must have completed therapy at least 28 days prior to enrollment. Tumor sample must be available for analysis of PDL1 (Programmed death-ligand 1) and HPV [Human Papilloma Virus (oropharynx only)] HER2/neu protein negative and programmed cell death ligand 1 (PD-L1)-positive Prior treatment with an agent that blocks the programmed death-1/ programmed death-ligand 1 (PD-1/PD-L1 pathway) (certain exceptions may apply) Subjects must not have received immunotherapy with programmed death receptor-1 (PD-1) or cytotoxic T-lymphocyte antigen (CTLA-4) targeted therapy. Central determination of programmed cell death ligand 1 (PD-L1) tumor status Availability of a representative tumor specimen that is suitable for determination of programmed death-ligand 1 (PD-L1) and/or additional biomarker status via central testing Able to submit tumor tissue that is evaluable for programmed death- ligand 1 (PD-L1) expression Prior anti- Cytotoxic T-lymphocyte-associated antigen 4 (CTLA-4), Programmed death-1 (PD-1), or Programmed death ligand-1 (PD-L1) or other immune checkpoint mAb exposure. Tumor tissue available for programmed cell death ligand 1 (PD-L1) testing Inclusion Criteria:\n\n For inclusion in the study, patients should fulfill the following criteria:\n\n - Aged at least 18 years\n\n - Documented evidence of Stage IV NSCLC\n\n - No sensitizing EGFR mutation or ALK rearrangement\n\n - No prior chemotherapy or any other systemic therapy for recurrent/metastatic NSCLC\n\n - World Health Organization (WHO) Performance Status of 0 or 1\n\n Exclusion Criteria:\n\n Patients should not enter the study if any of the following exclusion criteria are\n fulfilled:\n\n 1. Mixed small-cell lung cancer and NSCLC histology, sarcomatoid variant\n\n 2. Brain metastases or spinal cord compression unless asymptomatic, treated and stable\n (not requiring steroids)\n\n 3. Prior exposure to Immunomodulatory therapy (IMT), including, but not limited to, other\n anti-cytotoxic T-lymphocyte-associated antigen 4 (CTLA-4), anti-programmed cell death1\n (PD-1), anti-programmed cell death ligand 1 (PD-L1), or anti PD-L2 antibodies,\n excluding therapeutic anticancer vaccines\n\n 4. Active or prior documented autoimmune or inflammatory disorders (including\n inflammatory bowel disease [eg, colitis or Crohn's disease] Participants with any programmed death-ligand 1 (PD-L1) test result by immunohistochemistry (IHC) are eligible for the study have not received previous systemic therapy (including investigational agents) targeting programmed cell death protein 1 (PD-1)/ PD-1 ligand (PDL 1) or PD-1/PDL-2 signaling pathways. Prior therapy with other immune checkpoint inhibitors, including but not limited to, anti-CD137 antibody or anticytotoxic T-lymphocyte-associated antigen-4 antibody, is not permitted Per good clinical practice, any toxicity related to prior therapies that, in the opinion of the investigator, would potentially be worsened with anti-programmed death 1 (PD1) therapy should be resolved to less than grade 1 Subjects who have had chemotherapy or radiotherapy or any systemic therapy for melanoma within 3 weeks prior to entering the study or those who have not recovered from adverse events due to agents administered more than 3 weeks earlier; no concomitant therapy is allowed including interleukin-2 (IL2), interferon, ipilimumab, anti-programmed cell death 1 (PD-1) or anti-programmed death-ligand 1 (PD-L1) antibody, cytotoxic chemotherapy, immunosuppressive agents, or other investigational therapies Must provide a tumor sample (archival or newly obtained biopsy) that is adequate for determination of PD (programmed cell death)-Ligand 1 status by immunohistochemistry at a central pathology laboratory prior to enrollment. Note: Adequacy of the tumor sample for PD-Ligand 1 testing is not required prior to enrollment in Part 1C Subject whom participated in either arm of the following clinical trials CA209-017, CA209-057, CA209-026, and CA184-104 or received prior treatment with anti-programmed death 1 (PD-1) or anti-programmed death-ligand 1 (PDL1) experimental agents Histologically- or cytologically-confirmed diagnosis of NSCLC that is anti-programmed cell death ligand 1 (PD-L1) positive per central laboratory review Systemic cancer therapy (standard or experimental), including cytotoxic chemotherapy or IL-2, received less than 4 weeks or checkpoint blocking agents (e.g., cytotoxic T-lymphocyte protein [CTLA]-4 or programmed cell death protein [PD]1/PD-ligand [L]1 inhibitors) received less than 6 weeks prior to lymphodepletion, with the exception of targeted therapies Tumor cell programmed death-ligand 1 (PD-L1) score of tumor cells (TC)1-3 and immune cell PD-L1 score of tumor-infiltrating immune cells (IC)0-3 as determined by an immunohistochemistry (IHC) assay performed by the central laboratory on tissue obtained after the last line of therapy Has received any previous systemic therapy targeting programmed death (PD) 1 or PD-ligand 1/2 signaling pathways, and other immune checkpoint inhibitors Received any prior monoclonal antibody against cytotoxic T-lymphocyte antigen 4 (CTLA-4), programmed cell death 1 (PD1) or programmed cell death 1 ligand 1 (PD-L1) Can provide either a newly obtained or archival tumor tissue sample for intratumoral immune-related testing and for anti-programmed cell death (PD-1) Any prior or concurrent investigational or standard therapy for treatment of metastatic NSCLC including radiation therapy, chemotherapy, biological therapy (with the exception of tyrosine kinase inhibitor as a single agent, which must be at least 5 half-lives prior to day 1, and/or immunotherapy, such as a programmed cell death 1 [PD-1] or programmed cell death 1 ligand 1 [PD-L1] inhibitor, which the last dose must have been given at least 4 weeks prior to day 1) or hormonal therapy; (palliative-targeted radiotherapy for brain or bone metastases is permitted providing it has been at least 14 days prior to day 1) Tissue or Programmed death-ligand 1 (PD-L1) results available Cohort 1A Inclusion Criteria: Available tumor sample for Programmed death-ligand 1 (PD-L1) immunohistochemical (IHC) and exon 20 T790M testing Any previous treatment with a programmed cell death protein 1 (PD1) or programmed cell death-1 ligand 1 (PD-L1) inhibitor, including durvalumab Patients may have received up to two prior therapies including vascular endothelial growth factor (VEGF), mammalian target of rapamycin (mTOR) and programmed cell death (PD)-1/PD ligand 1 (L1) inhibitors; prior palliative radiation to metastatic lesion(s) is permitted, provided there is at least one measurable and/or evaluable lesion(s) that has not been irradiated Subjects may have failed a programmed cell death protein 1 (PD-1) or programmed death-ligand 1 (PD-L1) therapy for advanced disease. For Phase I: For treatment-experienced patients, the following washout periods are required prior to enrollment on the study: 2 weeks wash out after prior local therapy (such as radiation therapy or intra-lesional therapy), 4 weeks wash out after cytotoxic therapy or high dose interleukin-2, and 6 weeks wash out after anti-programmed cell death 1 (PD-1) or anti-programmed cell death ligand 1 (PD-L1) therapy; for all other therapy not mentioned, a wash out period of at least 5 half-lives will be needed Prior treatment with any therapy on the programmed cell death 1 (PD-1)/PD-L1 axis or anti-cytotoxic T-lymphocyte-associated protein 4 (CTLA-4) inhibitors unless enrolling the urothelial carcinoma with previous checkpoint inhibition therapy expansion cohort A history of prior treatment with ipilimumab, nivolumab or other cytotoxic t-lymphocyte-associated protein 4 (CTLA-4), programmed cell death 1 (PD1) or PD-L1 inhibitor Tumor programmed death-ligand 1 (PD-L1) expression, as determined by immunohistochemistry (IHC) assay of archival tumor tissue or tissue obtained at screening Prior therapy with a Cytotoxic T Lymphocyte Antigen 4 (CTLA-4) or Programmed death- 1\n (PD-1) antagonist, or Programmed cell death- ligand 1 (PD-L1) or CD137 agonists Prior treatment with a CD137 agonist, ipilimumab, or the cytotoxic T-lymphocyte antigen 4 (CTLA-4) inhibitor, or programmed death-1 (PD-1)/programmed cell death 1 ligand 1 (PDL-1) inhibitor Backfill cohort enrollment may be limited to participants whose tumors have PD-L1 (programmed death-ligand 1) and/or different levels of cluster of differentiation 8 (CD8) expression, as defined by the Sponsor Backfill enrollment in Phase Ib may be managed such that approximately half of the patients in each backfill cohort will not have been trated with prior immune checkpoint inhibitors (anti-PD-L1/PD-1 [programmed death-1] and/or cytotoxic T-lymphocyte-associated protein 4 [CTLA-4]), except for those patients with tumor indications where cancer immunotherapy (CIT) is approved as treatment by local regulatory authorities Additional Inclusion Criteria for Participants in Each Indication-Specific Exploration/Expansion Cohort of Phase 1b: Documentation of program death ligand-1 (PD-L1) status prior to randomization. Subjects must have programmed death-ligand 1 (PD -L1) immunohistochemical (IHC) testing, with results, performed by the central lab during the Screening period Has received previous treatment with an immunomodulatory agent (e.g., anti-programmed cell death 1/ anti-programmed cell death ligand 1 or cytotoxic T-lymphocyte-associated protein 4) and was discontinued from that treatment due to a Grade 3 or higher immune-related adverse event