Texas Governor Greg Abbott has ordered hospitals to gather data on the immigration status of patients, arguing Texas has had to "foot the bill" for the Biden administration's border policies.
Under the executive order, hospitals will have to compile statistics on inpatient discharges and emergency visits by undocumented migrants, as well as on the cost of caring for them.
Opponents say the order will lead to racial profiling and deter migrants from seeking help.
The order is the latest in a series of clashes between the federal government and Mr Abbott, a vocal critic of the Biden administration's border policies.
Thursday's order applies to all public hospitals and other healthcare providers identified by Texas authorities.
The data they collect must be gathered quarterly and passed on to the Texas Health and Human Services Commission, which will in turn provide regular reports to state officials.
"Due to President Joe Biden and Vice-President Kamala Harris' open border policies, Texas has had to foot the bill for medical costs for individuals illegally in the state," Mr Abbott said in a statement.
"Texans should not have to shoulder the burden of financially supporting medical care for illegal immigrants," he added.
Mr Abbott said the move would hold the Biden administration "accountable" for its "costly and dangerous" border policies.
The total potential cost of state healthcare for undocumented migrants is unclear.
In 2021 - the last year for which data is available - Teaching Hospitals of Texas calculated that "uncompensated charity care" cost the state's hospitals around $7bn (£5.49bn).
That data, however, does not break down costs by nationality or immigration status.
Some immigration advocates quickly condemned Mr Abbott's announcement.
Sylvia Garcia, a Democratic US representative whose district includes part of Houston said that the order was akin to "social engineering".
Ms Garcia told CBS, the OceanNewsUK's US partner, that the order risked turning doctors into immigration enforcement officers.
Gabriel Rosales, Texas state director for the League of United Latin American Citizens, or Lulac, said the order would lead to "racial profiling".
“It’s going to immediately intimidate the community, our immigrant community, from trying to get the help that they need," he told Border Report. "This is completely uncalled for."
Mr Abbott's executive order says it will "not affect patient care". However experts have warned that it may ultimately deter migrants from seeking help when needed.
"People are allowed to get care regardless of their citizenship," Julia Gelatt, an analyst at the Washington-based Migration Policy Institute, told CBS.
"But we know that asking questions can make people worried about immigration consequences and whether or not it's safe to seek care," she added.
Under Mr Abbott, Texas has repeatedly challenged the federal government on immigration matters, resulting in several legal battles.
These include the bussing of tens of thousands of migrants to Democratic-led cities, and the construction of floating barriers along the Rio Grande to prevent migrant crossings.
The number of unlawful crossings by migrants at the US southern border has dropped for the fifth consecutive month, according to official data.
US Border Patrol agents apprehended around 57,000 migrants along the border in July - the lowest recorded since September 2020.