Embracing corporate sustainability has emerged as a crucial strategy for companies to bolster their competitive edge and reputation. This research delves into the connection between environmental, social, and governance practices (ESG) and the cost of debt, as well as the moderating role of financial distress within this connection. By analyzing data from Saudi-listed firms between 2013 and 2021, we discovered that ESG practices have a notable negative impact on borrowing costs. This implies that organizations with increased transparency in their ESG disclosure gain access to external financial resources under more favorable terms. Additionally, we observed that the effect of ESG on the cost of debt is significantly and negatively moderated by the financial distress encountered by a firm. To bolster the credibility of these findings, dynamic generalized method of moments (GMM) models were utilized to address any potential endogeneity concerns, thereby enhancing the strength and resilience of the outcomes. The findings of this paper hold substantial value for investors, lenders, corporate management, and policymakers when considering the implementation and significance of a company’s ESG practices.