There are two different discussions here really.
One is the economic impact of illegals. We can get into the weeds but at a high level they are an overall benefit to the economy. That said, they don't come without cost either.
The other of course is political. The position of both parties has changed over time. I'll offer a few examples. In 2007 in an interview with Lou Dobbs, Bernie Sanders said “Open borders? No. That’s a Koch brothers proposal… it would make the working class even poorer." In 2013 Bernie Sanders said companies bringing in foreign un-skilled labor could hurt American workers, because they could drive down wages. In 2015 Bernie told the Hispanic Chamber of Commerce that open borders would substantially lower wages in this country.
There was a window between roughly 2005 and 2013 when Democrats attacked Republicans for supporting illegal labor and hurting workers. I need to grab the specific quotes, but the tone was the opposite of what we hear now.
This one isn't an economic issue but in 1995 Bill Clinton said "We are a nation of laws, and we will not tolerate illegal immigration."
I am not saying he is correct, but I once heard Chuck Todd make an interesting argument. He said Democrats misread Obama’s 2012 victory. Obama won a large share of the Latino vote, and Todd’s view is that Democrats saw that as the future and shifted toward identity politics. He argues the real reason Obama beat Romney was old fashioned class politics. As a private equity guy Romney was painted as the person who cost you or your family a job, and it worked.
Since Democrats have focused more on identity politics, their rhetoric towards illegal immigration has switched. They still win a majority of the Latino vote, but the Republican Party has gained a larger share in recent years.