Maybe the world will end when the sun runs out of hydrogen and expands to the point where it will absorb Mercury and Venus and possibly the Earth. If it doesn't absorb Earth, Earth would become much like the way Mercury is now, precluding the existence of life as we know it. But that's not to happen until about 5 billion years or so.
Even then, our species will be able to travel to other stars.
Eventually there will no longer be any stars, as they will have consumed all the available fuel in the galaxy, but our descendants will still be able to survive using fission and fusion power. You can get a lot of fusion fuel out of a single gas giant. And after consuming one you can move on to another.
Eventually the galaxy will dwindle away, as gravitational interactions will occasionally eject stars and planets out of the galaxy. There are a lot
of stars and planets in the galaxy, but it is still a finite number, and over a very long period of time the galaxy will slowly boil away until there are only a handful of dead stars and planets left orbiting a supermassive black hole. So eventually our descendants will run out of their last fuel source and there will not be another fuel source to move on to. At that point, extinction is assured.
But that will be a very
long time in the future.