What will happen to the sun and the earth in the distant future?
In the distant future, neither the Sun as we know it nor the Earth will exist. The Sun, as we know, is a star, and all stars experience life cycles. They are born from clouds of dust and hydrogen gas called nebulae, from which they take the shape and composition of stars, with multiple layers beginning with a core in which constant nuclear reactions occur, emanating heat in the tens of thousands of degrees. The Sun, around which the Solar System that includes the Earth orbits, is estimated to be about 4.6 billion years old, which astronomers believe represents the middle of this particular star's life. In other words, the Sun will cease to be a star capable of supporting life as we know it in a few billion years. In fact, we know from observing stars in their various stages of life that the Sun will eventually expand outward until it reaches the stage called Red Giant, following which it will collapse with terrific force into a White Dwarf. All of this takes billions of years. When estimating the Sun's status in "the distant future," then, we know it will eventually die, but what we don't know with absolute uncertainty is at precisely what stage of its life it will render Earth uninhabitable. At some point, though, that stage will definitely occur. The distant future involves the destruction of Earth, and current estimates place the end of the planet's ability to support life at about 750 million years.
As the Sun expands towards its eventual formation as a Red Giant, its outermost atmosphere will consume the planets in its solar system. Earth being the third closest to the Sun, that phase of our star's life will destroy this planet. Astronomers are only now able to locate and study planets outside of our Solar System. Such so-called "exoplanets" provide clues as to the habitability of planets of a certain size and distance from their stars, but there is no real precision involved here because we have no parallels from which to draw conclusions. We don't know at precisely what point in the Sun's life the Earth will become uninhabitable, but we do know that point will be reached in less than one billion years.
The sun is a star. Most of stars explode, but not all of them. The sun is one of those stars that don't explode. The sun will gradually get warmer. As it gets warmer, it will start getting bigger. Once it is bigger, it will turn into a Red Giant star. That won't be for another 5 1/2 billion years. After a billion years of being a red giant star, it will start shrinking and become a white dwarf star. It will be a white dwarf star for a couple billion years.