In anticipation of the Janus ruling, major public-sector unions have invested heavily in recent years in reaching out to current members — an effort known as internal organizing — and to prospective members to keep their numbers from dropping precipitously and to create a more activist culture. They plan to continue funding these initiatives even if it requires cutting spending elsewhere.

Mary Kay Henry, the international president of the service employees union, said the union used projections derived from its experience after the Harris decision to cut its budget by 30 percent shortly after Mr. Trump was elected. She said the union, which represents about two million workers, roughly half of them in the public sector, was focusing its spending on recruiting members and mobilizing workers to face down employers and elect pro-labor politicians.

“We intend to prioritize the political and organizing work,” she said.

Government filings show that the union has cut contributions to organizations that it had traditionally supported, including the Children’s Defense Fund, People for the American Way, and the National Immigration Law Center. (The union says it provides nonmonetary support to some of these groups.)

At the same time, the union is investing tens of millions of dollars in a door-to-door canvassing initiative for the midterm elections, intended to turn out people who don’t normally vote.

Lee Saunders, president of the American Federation of State, County and Municipal Employees, said that his union’s two highest priorities going forward would be its internal outreach and helping to organize nonunionized workplaces, and that the union would probably “have to make adjustments” to fund these programs. The union spent more than $15 million during the 2016 campaign cycle supporting political candidates, parties and committees.

Mr. Saunders said the union, which represents over 1.2 million workers, had held one-on-one conversations with nearly 900,000 members since 2013. Among the goals of these conversations, he said, is to inoculate members against campaigns by conservative groups to urge them to quit.

“If someone knocks on their door talking about how you can get out of the union — ‘it would be so easy, you don’t have to pay union dues’ — our folks are prepared to tell them to get the hell off their doorstep,” he said.