Free and open access to global development data
data.worldbank.org
I don't believe we are heading for 10 billion.
Global birth rates have shrunk to 2.3 birth per woman. Basic population replenishment is 2.1 and the rates have been on a steady downward trend. Developed countries suffer from this more then any others, where in many countries the importation of migrants is seen as a solution to the issue of having enough workers. At the extreme end places like South Korea and Japan, some of the more prosperous, developed, and industrialized nations, are actively dying out. You'll note the world bank data cuts off at 2021. However the decreases are definitely continuing.
By 2050, over three-quarters of countries will not have high enough fertility rates to sustain population size over time. This will increase to 97% of countries by 2100.
www.healthdata.org
I don't know if we will shrink to 500 million. It was a bit of an arbitrary figure. But there are technologies that only make sense at scale and improvements that only become necessary with a growing population. We have a definite situation where developed countries dip into a negative population growth trend. And we have more and more countries becoming developed over time. Now maybe development will stop or even rollback. Or maybe something will emerge to get developed countries birth rates up. But as it stands, I believe we're heading for a significant population decline in much of the world, possibly all of the world in a forseeable future. I think right now shrinking populations are a bigger problem then growing populations.
As for 20 billion and the earth's carrying capacity, I think this is overblown. We can't all drive SUVs and live in suburbs with massive commutes, but with reasonable urban planning, good public transit, and an effort to invest in things like renewables and nuclear energy, the carrying capacity of the earth is far larger then 10 billion. There are many reasons for why the current carbon footprint is as large as it is that have to do with economic choices and lifestyles rather then direct quality of life issues.