There's a great deal of ignorance and misinformation, found mostly on the right, as to what constitutes a so-called 'sanctuary city.'
The Federal government cannot compel state and local governments to enforce Federal laws, including immigration laws. (See e.g.
Printz v. US)
“Cities and States aren’t obligated to use their own resources to help enforce Federal immigration laws. Sanctuary cities are just places that have standardized that decision to put those resources elsewhere.”
Sanctuary Cities and Immigration | LegalMatch Law Library
If a jurisdiction were to be asked by Federal authorities to detain someone suspected of having entered the country without authorization, such a jurisdiction would comply in accordance with Federal law.
But there is nothing compelling cities or other local jurisdictions to unilaterally seek out and detain those suspected of being undocumented, using their own limited resources, absent being requested to do so by Federal authorities, nor would a city making the decision to not unilaterally seek out and detain those suspected of being undocumented be in 'violation' of Federal immigration law.
The ridiculous notion that so-called 'sanctuary cities' are somehow 'aiding and abetting' those undocumented from being detained by Federal authorizes is an absolute lie.