As a matter of international law, the United States has argued since the Obama administration’s September 2014 Article 51 letter to the U.N. Security Council that the use of force against ISIS within Syria, despite the lack of Security Council authorization or Syrian consent, is lawful based on the controversial “unable or unwilling” doctrine.
The U.S. argument is that “States must be able to defend themselves, in accordance with the inherent right of individual and collective self-defense, as reflected in Article 51 of the U.N. Charter, when, as is the case here, the government of the State where the threat is located is unwilling or unable to prevent the use of its territory for such attacks.” On this view, a State may use force in another State’s territory in reliance on the “unable or unwilling” theory of self defense “if measures short of force have been exhausted or are inadequate to address the threat posed by the non-State actor [ISIS] emanating from the territory of another State.”
The scope and content of this theory, and even whether it has attained the status of a customary rule of international law at all, remain deeply contested.
(source)
Somewhat aside, there's a [2016] list here of other counties that have invoked this; the list is split by clarity of statements in 3 groups. It's mostly Western countries, Israel, and Turkey in the most explicit group. A little surprisingly, that group even includes Russia wrt. Chechen rebels allegedly operating from Georgia in 2002, but Russia later has articulated the opposite position with respect to Syria. In the more ambiguous wording category, there's also Iran, with respect to MEK in Iraq. Most invocations involve just strikes rather than more permanent basings, I think.
Regarding (per comment below) whether ISIS is still considered a threat by the US, I've not been able to find a detailed statement by the present administration, but some Congressman (House Foreign Affairs Committee Chairman Michael McCaul) recently said things like
Even though ISIS no longer controls significant territory, there are still tens of thousands of hardened terrorist fighters in Iraq and Syria who are hell bent on re-establishing their terror state.
In the last quarter of 2022, ISIS claimed 72 attacks in Iraq and Syria, including several IED attacks.
Thankfully, our small deployment of U.S. service members is remarkably effective at working with local partner forces to achieve results – and ensure the enduring and complete defeat of ISIS. Otherwise these numbers could have been much worse.
In 2022, we were involved in 108 partner and 14 unilateral operations, killing 466 ISIS operatives and detaining 215 others.
There's a presser by the State Department too (March 23, 2023), but it doesn't include a detailed assessment of the present ISIS activity/threat:
we continue to take the necessary steps to remove key Daesh/ISIS leaders from the battlefield, facilitate the repatriation and return of Daesh/ISIS fighters and associated family members, and stabilize liberated areas. This includes our military mission in Syria by, with, and through our local partners including the Syrian Democratic Forces, and our advise, assist, and enable role at the invitation of the Iraqi Security Forces, which remain firmly in the lead on countering Daesh/ISIS in Iraq. The mission of the Global Coalition in Iraq and Syria is not complete and requires the ongoing support of the international community.
Al-Jazeera (while noting the vehement opposition of the Syrian government to US involvement) says:
US forces have killed or arrested ISIL figures in numerous operations, including the group’s leader Abu Bakr al-Baghdadi in 2019.
On February 19 [2023], the US military said troops working with SDF captured an ISIL provincial official.
The raid came a day after four US soldiers were wounded as they conducted another raid to kill a senior ISIL group leader in northeastern Syria, the US military’s Central Command said.
Checking on that al-Baghdadi was killed in Syria. Another al-Jazeera piece adds:
His successor Abu Ibrahim al-Hashimi al-Qurayshi was also killed in Syria in a similar US operation last year [2022].
(Somewhat more interestingly, this "2nd Caliph" was killed very close to Syria's border with Turkey. As CNN contextualized this, the raid on this guy came one month after 100 ISIS fighters tried to break out [apparently thousands of] their comrades from a detention camp. That seems to have been the last major operation of ISIS.) Of course, that year the US was able to pull off an attack on al-Qaeda's head in Afghanistan, without overt troops on the ground, but then the local Kurds still welcome the US troops in Syria, while the Taliban don't. So I suppose there's that practical difference. Whether the US would still find it worthwhile to maintain the ground presence in Syria if attacks on them by others (Iranian proxies etc.) intensify, is anyone's guess.
The US doesn't seem to claim any direct involvement in the [combat] death of the "3rd Caliph" in Nov 2022, also in Syria. Rather he died fighting [nominal] Assad allies. So that does raise the question whether the US is still on firm ground claiming that the Syrian government is "unwilling and unable". OTOH no Syrian armed forces personnel was involved in that fight either, only a loosely affiliated militia that prior to 2017 was backed by the US. And the US was contacted/involved in DNA testing this guy's body to identify him. (According to the Jordan-based Syria Direct, that [sub-]group which killed this "3rd caliph", was then directly backed by Russia until 2021. Although its leader then visited Turkey, a week after the fight, according to MEI.)