This is a relatively old problem for humanity, but that has been gaining new nuances with each major wave of innovation: the agricultural revolution (arguably where the problem really started), then the industrial revolution and currently the computer revolution.
The problem in its current form is this: humanity possesses both the resources and technology to provide basic necessities to everyone in the planet: housing, food, water and basic medical care. However, the current economic system does not create incentives for this to happen, and there are many other social and cultural impediments. An important point is this: it is a social, not a technological problem.
Of course it is hard to consider this problem without discussing some famous attempts. I will list some obvious ones, while trying to avoid ideological discussions -- one of the social impediments that gets in the way addressing this issue rationally. Of course, this is a highly simplistic summary:
Marxism / Communism appears to have failed due to removing incentives for people to work. Extreme collectivism appears to eventually lead to brutal repression, because the only way to survive is then to force people to do what the collective needs.
Contemporary Capitalism appears to be collapsing under increasing inequality. Once a small fraction of the population amasses a significant portion of the resources, it becomes capable of creating international organizations that both transcend and dictate local laws, effectively side-stepping democracy.
Proponents of both Marxism, Capitalism and other systems -- let's consider an abstract ideology X -- typically use the argument that what failed was not "true X". "True X" would solve all the problems. Upon examination, "True X" always seems to assume perfect people acting in good faith.
Is it possible to devise a system that does not require ideal humans to work?
We are currently stuck in a situation where resource distribution is done through jobs. The problem is that, as technology progresses, more and more jobs become obsolete. It appears that we are already in a situation where the adult population vastly outnumbers the number of real jobs available. Social scientists are pointing out the phenomena of "bullshit jobs" -- an increasing number of unnecessary and meaningless jobs that are created to maintain social stability. This is tragic: people are being imprisoned for large chunks of their lives simply because there is no sane way of redistributing wealth.
Another unsustainable aspect of the current economic system is its reliance on growth. It is trivial to conclude that infinite growth cannot be maintained in a finite environment, and it is also trivial to observe how destructive this position is to the environment. One simple illustration of this is the phenomena of "planned obsolescence". As with bullshit jobs, planned obsolescence consumes real resources to achieve the abstract aim of economic stability.
How to create the incentives for people to cooperate, maintain scientific and technological progress, increase individual freedom and reduce unnecessary suffering? Can such a system be imagined without falling for the "perfect human beings" trap?