Former President Barack Obama remains hopeful that America can solve its political divisiveness.

But he also has a stark warning for the US: Our economy and our democracy are at risk if we can't get past the finger-pointing, partisan morass that has gridlocked the nation for years.

Obama also said that technology from mobile phones to social networks is helping tear us apart, rather than bring us together.

This is a new, more serious change of tone for the 44th president since he left office at the beginning of 2017, handing the White House keys to the Trump Administration.

Former President Barack Obama was on stage Wednesday evening at a tech conference in Las Vegas hosted by identity security company Okta where he talked about the future of the country.

Obama's previous public appearances since leaving office have been unfailingly hopeful about America's future. But when Okta CEO Todd McKinnon asked Obama his thoughts on the nature of identity these days, Obama drifted into words of warning.

"We live in a culture today where everybody feels the crush of information and the collision of worlds," Obama explained.

This is very different than how our ancestors lived, he pointed out. Humans have, for most of their history, lived their whole lives in the same basic geographic area where they were born, had a network of friends that stretched to maybe 150 people and lived in societies "with very clear rules and expectations," Obama said.

"That's sort of how our brains are wired," he said.

But today, people can easily move across the country or across the world. And everyone uses technology — even in developing areas, like Africa, everybody has a mobile phone.

That means our world is more connected, and technology is reshaping our relationships, our access to information and the way we make our livings.

Obama said "the great thing about the United States" is that we've had a "head start" over dealing with this kind of setup compared to the rest of the world because we are a nation of immigrants.

"We are a people that came from everywhere else, so we had to figure out how to join together and work together, not based on race, or religious faith or even, initially, language, but based on creed and a sense of principals," he said.

The challenge Americans face today is "how do we maintain that sense of common purpose, our 'in it together,' as opposed to splintering and dividing? As we are seeing in some debates in social media and elsewhere, it's harder to do today. But I think it becomes more necessary than ever, because if we don’t figure it out, not only will it be hard for our economy to survive but it is going to be hard for our democracy to survive."

Obama believes that one important way we can maintain and increase a national identity, where citizens view themselves as Americans first, rather than members of a particular tribe (like our political party, or race, or gender) is by sharing stories with each other. The more we can do that, the more we'll see each other as fellow humans, rather than as caricatures representing some other tribe.

One place to start is to ask everyone, no matter where in the political spectrum you fall, to expand your media sources, he suggests.

"Right now part of our polarization is that if you watch Fox News all day, or you read the New York Times, you are occupying two different realities. We have to be able to figure out, in this multiplicity of platforms, to have some common baseline of facts that allow us to meet and solve problems," he said.

More from President Obama's talk on Wednesday: