“As Americans, what we need to do is to have a sane system that keeps us safe at the border, but does not criminalize the activity,” she said.

Representative Tim Ryan of Ohio, one of several candidates staking out a more moderate approach, responded by saying, “If you want to come into this country, you should at least ring the doorbell.”

In a sign of the escalating concerns within the party, several Democratic governors this month expressed alarm about open borders rhetoric. And a document recently circulated to House Democrats from party consultants advised a more moderate approach — suggesting the party emphasize a path to citizenship for undocumented immigrants who “work hard and pay their taxes” but also stress the importance of secure borders.

[Sign up for our politics newsletter and join the conversation around the 2020 presidential race.]

“Beyond policy, the best frame on immigration acknowledges the problem and talks about solutions — both addressing border security and a path to earned citizenship,” read the memo, which was addressed to the Democratic Congressional Campaign Committee.

A recent Gallup poll found that immigration tops the list of issues that Americans view as important. Mr. Trump’s demands for a wall at the Mexican border, as well as tighter restrictions on immigration, have emerged as an emotional issue in the presidential campaign. The president and his supporters have called Democrats soft on enforcement, while Democrats counter that the wall and inhumane treatment of those seeking asylum are antithetical to the core values of the United States.

There are few places where the topic is more contentious than in Wisconsin, a swing state where it has been used as a cudgel against Democrats, even in local races for elected positions with no role in federal immigration policy.