A medium-mass star will become a planetary nebula at the end of its cycle.
Life cycle of a medium-mass star
A medium-mass star, like the Sun, concludes its lifecycle by expanding into a red giant, undergoing helium burning, and shedding outer layers to form a planetary nebula.
The remaining core transforms into a white dwarf, a dense remnant composed mainly of carbon and oxygen. Over time, the white dwarf cools and becomes a dark, inactive object known as a black dwarf.
However, as of now, no observed black dwarfs exist, as this cooling process extends far beyond the current age of the universe.