Inclusion Criteria:  B-cell malignancy. Patients must have received prior therapy. Patients must have an objective indication for therapy. Eastern Cooperative Oncology Group performance status (ECOG PS) of 0-2. Anticipated life expectancy of greater than or equal to (≥) 12 weeks. Adequate bone marrow function. Adequate hepatic function. Creatinine clearance of ≥ 60 milliliters (mL)/minute. Ability to swallow tablets. Ability to comply with outpatient treatment, laboratory monitoring, and required clinic visits for the duration of study participation. Prior treatment-related adverse events (AEs) must have recovered to grade less than or equal to (≤) 1 or pretreatment baseline, with the exception of alopecia. Men with partners of childbearing potential or women of childbearing potential (WOCBP) must agree to use highly effective birth control. WOCBP must not be pregnant.  Exclusion Criteria:  Prior to identification of the RP2D (Dose Expansion) of LOXO-338, a history of known, active or suspected:  Richter's transformation to diffuse large B-cell lymphoma (DLBCL), prolymphocyticleukemia, or Hodgkin lymphoma Transformed low grade lymphoma Burkitt or Burkitt-like lymphoma Multiple myeloma Lymphoblastic lymphoma or leukemia Posttransplant lymphoproliferative disorder Known or suspected history of central nervous system (CNS) involvement.  History of allogeneic or autologous stem cell transplant (SCT) or chimeric antigen receptor-modified T cell (CAR-T) therapy within the past 60 days and with any of the following:  Active graft versus host disease (GVHD) Cytopenias from incomplete blood cell count recovery post-transplant or CAR-T therapy Need for anti-cytokine therapy for toxicity from CAR-T therapy; residual symptoms of neurotoxicity Grade > 1 from CAR-T therapy Ongoing immunosuppressive therapy Known human immunodeficiency virus (HIV) positive, regardless of cluster of differentiation 4 (CD4) count. Unknown or negative status eligible. Inability to take necessary uric acid lowering agents (i.e., allopurinol, rasburicase, orfebuxostat). Concurrent anticancer therapy. Concurrent treatment with strong cytochrome P450 3A4 (CYP3A4) inhibitors or inducers that can include antifungals. Use of ≥ 20 milligrams (mg) prednisone once a day (QD) or equivalent dose of steroid per day, within 7 days of start of study treatment. Patients may not be on any dose of prednisone intended for antineoplastic use. Vaccination with a live vaccine within 28 days prior to start of study therapy, with the exception of vaccinations for coronavirus disease 2019 (COVID-19), as applicable. Live vaccination for COVID-19 should occur at least two weeks prior to cycle 1, day 1 (C1D1). Major surgery within four weeks of planned start of study therapy Prolongation of the QT interval corrected by Fridericia's Formula for heart rate (QTcF) greater than (>) 470 milliseconds (msec). Clinically significant cardiovascular disease. Female patient who is pregnant or lactating. Active second malignancy which may preclude assessment of DLT. Clinically significant active malabsorption syndrome including surgical resection of small intestine or other condition likely to affect gastrointestinal (GI) absorption of the orally administered study drugs. Active hepatitis B or C infection. Evidence of other clinically significant uncontrolled condition(s) including, but not limited to, uncontrolled systemic infection (viral, bacterial, or fungal) or other clinically significant active disease process. Active uncontrolled auto-immune cytopenia.  Additional exclusion criteria for patients enrolled to part 2: LOXO-338 and pirtobrutinib combination  Prior progression or intolerance to pirtobrutinib. Patients requiring therapeutic anticoagulation with warfarin. Known hypersensitivity to any component or excipient of pirtobrutinib. In patients with history of myocardial infarction or congestive heart failure, documented left ventricular ejection fraction (LVEF) by any method of ≤ 45 percent (%) in the 12 months prior to planned start of study treatment. History of uncontrolled or symptomatic arrhythmias including grade ≥ 3 arrhythmia on a prior BTK inhibitor. History of major bleeding on a prior BTK inhibitor. Current treatment with strong permeability glycoprotein (P-gp) inhibitors.