“I think tax withheld in foreign countries is deductible in the US but you must file for it. Your broker reports it and TurboTax and others file for it automatically.”
If the country has a tax treaty with the US & similar tax percentage, the process is relatively straightforward. For example, Canadian tax withholding is 15% and just becomes a foreign tax credit (up to around $150 - $200). Filing becomes more complicated when the dollar amount is higher or the tax rate is higher. That will apply to me in filing 2022 tax forms since I have significant ZIM dividends and Israel withholding is a higher %.