This question relates to the angst depicted in the movie Annie Hall, when the younger version of Woody Allen's character feels demotivated about life when he realizes that the universe is expanding.
For the sake of this question, I'll assume that there's an as yet unknown argument to justify a telos, an aim, or a purpose for our civilization's existence and actions, analogous to an individual human being's self assured will to live and to make choices.
On a pragmatic level, it seems safe to assume that it's typical for human beings to make choices based on use: We keep doing things that'll benefit others, and perhaps ourselves. We do things to minimize our future regrets. But given the finiteness of an individual's lifetime, that translates to actions that'll benefit those who'll continue to live after the lifetime of the individual.
Now it is true that the civilization as a whole (by which I mean the 8 billion of us), although a big complex system, does not possess a centralized information processing unit to direct its own actions, in the best possible way, like the way the brain directs an individual's actions. But, nevertheless, it seems to take a course, shaped by many different factors over timescales much larger than the lifetimes of any individual person.
That flow, hopefully for the common good, seems to provide some motivation at an individual level to make choices that'll contribute positively, at varying levels, to the current and future societies. That motivation works at the level of an individual, and also at the level of groups of individuals, such as an organization.
Assuming no malice, the choices made by such individuals or organizations, are invariably directed to benefit life—- life of people, or life of other living things on earth.
But now I want to consider the fact that in approximately five billion years from now, when the sun enters the red giant phase, it's very likely that all life on earth will cease to exist2. Assuming that life is unique to planet earth and doesn't exist anywhere in the cosmos, after that point, it's just lifeless, rocky, cosmic emptiness everywhere, for eternity.
After that point, whatever it is that was done before with intention and purpose, either at an individual level or the societal level, won't matter. How to save oneself from the angst that can arise from this realization?