It is believed that Bitcoin will run out by 2040,
No. This is not correct.New bitcoins will continue to be created for more than another 100 years.
This is because mining becomes exponentially more difficult and power-hungry every four years,
No. This is not correct.It is because the amount of new bitcoin that is allowed to exist in each new block of the blockchain is cut in half (and rounded down to the nearest satoshi) every 4 years.
Mining can become more difficult, or it can become easier. The difficulty of mining is determined only by the total global amount of hashpower that is being applied to the process. Mining does not become more power-hungry. It actually has continued to use less and less power per hash over time. It's just that more people have discovered the opportunity, and so, therefore, more equipment is being operated.
a Bitcoin mining transaction could equal the energy consumption of a small country in 2021.
No. This is not correct.The mining process accomplishes MUCH more than just processing a single transaction. It is disingenuous to try to apply to a single transaction the entire power used for securing and maintaining a global permissionless economic system.
I found these topics in an article, I hope the opinion of experts in this regard.
You found a BAD article. Go, learn more and talk less.