Abstract Background: Immune checkpoint inhibitors (ICI) can achieve remarkable clinical responses in urothelial cancer (UC). However, it remains unclear which aspects of the tumor microenvironment (TME) determine a patient’s response. The TME is usually characterized by immune cell density, which ignores cells’ spatial relationships relative to each other. Methods: Using multiplex immunofluorescence data (PanCK, CD20, CD68, CD3, CD8, and FoxP3 antibody panel) of 24 pre-ICI UC transurethral resections retrieved from the NABUCCO trial (NCT03387761), we spatially profiled cancer cells, macrophages, B-cells, and distinct T-cell populations. We first quantified the TME immune cell densities at the tumor and stroma tissue compartments. We then quantified the TME spatial relationships with a novel approach based on fitting a Weibull function to the first nearest neighbor (1-NN) distance distribution, allowing us to uniquely summarize spatial relationships with two parameters (Weibull approach). We compared this approach to conventional techniques (G-functions) that rely upon a predefined distance threshold. We performed a simulation study to identify sources of variation in the spatial relationship parameters. Lastly, we associated the TME parameters with ICI (ipilimumab + nivolumab) response. Results: Unlike the Weibull approach, the G-function quantifications manifested a variable effect size and statistical power in association studies because of its distance threshold dependence. We found that variation in density affected the spatial relationship metrics of rare cell types (i.e., B-cells) but not of abundant cell types (i.e., cancer cells). The spatial relationship metrics from the Weibull approach outperformed immune cell density in ICI response prediction. Specifically, immune cell density did not discriminate between ICI response groups (FDR>10%). In contrast, the spatial relationship between either CD8+ T-cells or macrophages to their closest cancer cell did associate with response to ICI (FDR=1%). Furthermore, non-responding tumors were characterized by CD8+ T-cells close to B-cells (FDR=9%). Importantly, we validated the association between proximity and response from CD8+ T-cells to cancer cells (FDR=1%) and from macrophages to cancer cells (FDR=1%) using data from 25 pre-ICI head and neck squamous cell carcinoma tumors from the IMCISION trial (NCT03003637, arm B, ipilimumab + nivolumab). Conclusion: We created a framework to quantify, study, interpret and analyze spatial relationships in the TME and illustrated its superior clinical relevance compared to density metrics for predicting ICI treatment response. Our findings emphasize the importance of spatial relationships in the TME for response and suggest that proximity between either macrophages or CD8+ T-cells to cancer cells are candidate biomarkers for ICI response. Citation Format: Alberto Gil-Jimenez, Nick van Dijk, Yoni Lubeck, Maurits L. van Montfoort, Dennis Peters, Erik Hooijberg, Annegien Broeks, Joris L. Vos, Charlotte L. Zuur, Bas van Rhijn, Daniel J. Vis, Michiel S. van der Heijden, Lodewyk F. Wessels. Spatial relationships in the tumor microenvironment predict response to immune checkpoint inhibitors in urothelial and head and neck cancer. [abstract]. In: Proceedings of the American Association for Cancer Research Annual Meeting 2023; Part 1 (Regular and Invited Abstracts); 2023 Apr 14-19; Orlando, FL. Philadelphia (PA): AACR; Cancer Res 2023;83(7_Suppl):Abstract nr 5786.