One of the House bills, known as the No Sanctuary for Criminals Act, potentially broadens the pool of money that cities could lose for not cooperating with federal immigration officials. It also seeks to indemnify local law enforcement officials who detain immigrants on behalf of the federal authorities from lawsuits, making the federal government the defendant in such cases. The bill passed 228 to 195.

In April, a judge in San Francisco temporarily blocked an executive order issued by Mr. Trump that would have tied billions of dollars in federal funding to localities’ willingness to cooperate with immigration enforcement.

Last month, Attorney General Jeff Sessions clarified the order in a way that narrowed both the definition of sanctuary cities and the federal funds they might lose by failing to share information about people’s immigration status with the federal authorities.

The other bill, known as Kate’s Law, stiffens penalties for immigrants guilty of felony re-entry. The bill is named for Kathryn Steinle, who was shot to death in San Francisco in 2015, reportedly by a Mexican laborer who had been deported multiple times and was in the United States illegally. The bill passed 257 to 167, with 24 Democrats joining Republicans in supporting the measure.

Saturday is the second anniversary of Ms. Steinle’s death. Her parents sued the San Francisco Sheriff’s Department, as well as Immigration and Customs Enforcement and the federal Bureau of Land Management. In January, a judge dismissed the case against the sheriff’s department and ICE, but allowed the case against the Bureau of Land Management to continue.

Mr. Trump, who started his presidential campaign just weeks before Ms. Steinle was killed, pointed to the case at the time as “yet another example of why we must secure our border immediately.”