“We don’t want to spend the rest of our lives in hotels,” Mr. Santiago said. “We’re not asking FEMA to support us, just to help us until we are more stable. If this has been so hard for me, I can’t imagine what it’s like for the people with little kids or illnesses.”

Mr. Santiago moved to Florida in December from Corozal, where his home was destroyed. He is working for a transportation company but not earning enough to afford an apartment.

“Every time the deadline approaches, your nerves are shot,” he said.

Lawyers for LatinoJustice argued that survivors of past storms had received more help. Hurricane Katrina survivors stayed in hotels for 27 months, Ms. Bannan said. Hurricane Harvey and Irma victims received seven benefit extensions, but Hurricane Maria survivors received just three, the group said.

The judge found, however, that those previous storms affected far more people.

The governor of Puerto Rico, the judge noted, stopped asking for extensions to the voucher program once a provision under FEMA rules took effect that would have required the government of Puerto Rico to share 10 percent of the housing costs.

The governor’s office did not immediately respond to a request for comment.

FEMA said there are 1,038 families still receiving Transitional Shelter Assistance across 27 states, with about 400 of them in Puerto Rico.

“FEMA is working with its vendor and notifying participating hotels that the TSA program has been extended to comply with the court’s order, said Lenisha Smith, a FEMA spokeswoman. “Beyond that, FEMA will not comment on pending litigation.”

Although Judge Hillman found that FEMA’s funding of the housing assistance program was “discretionary” and denied the request for an injunction, he urged the government to find a way to help the families.