SALT LAKE CITY — In September, a billboard appeared near downtown here urging voters to support Proposition 2, an initiative to legalize medical marijuana that is on the ballot Tuesday. Quoting from Mormon Church scripture and its “word of wisdom” about food and drink, the billboard read, “All Wholesome Herbs God Has Ordained for the Use of Man.” In other words, you can use pot for your medical ills and still be a good Mormon.

But will Mormons listen?

The debate over marijuana highlights an emerging dynamic in this fast-growing Western state. It pits Utah’s conservative political establishment, centered on the Republican Party and the Mormon Church, against a growing population of younger, less religious, more ethnically diverse and politically liberal residents. Indeed, the Church of Jesus Christ of Latter-day Saints has been increasingly forced to find common ground with these voters. And medical marijuana may be just the latest example of this shift.

Over the last three decades Utah has been a one-party state. All of its current federal office holders are Republicans. But when Donald Trump won the state in 2016, it was not with a majority: He took 46 percent of the vote, with Hillary Clinton receiving 27 percent and an independent candidate, Evan McMullin, getting almost 22 percent. According to one nationwide polling group, the drop in Mr. Trump’s approval since inauguration has been the greatest in Utah. The state’s generally polite churchgoing culture seems uncomfortable with the president’s pettiness, self-absorption, vulgarities and vanity.

About 60 percent of Utah residents describe themselves as Mormon, a significant number of them nonpracticing. But in Salt Lake City, a majority of the population does not identify as Mormon. The city’s L.G.B.T. population is vocal and visible. Utah’s Latino population has increased in recent years to 13 percent, and the state has long welcomed refugees from around the world. It is worth recalling that the 19th-century Mormon trek west stemmed from government persecution, and that since then, the church has had an extensive missionary program that has brought immigrants from across the globe here.