Ronaldo is no longer as effective a striker as he was a few years ago, but he is still physically fit, can still score goals and wants to play for Portugal. While that is the case, it will be difficult for any Portuguese coach to leave him out of the Portugal national team. Ronaldo is an institution in Portugal.
As for Messi, I think I read his statement somewhere that he still wants to play for the Argentinian national team, so it is not impossible that we will see both Ronaldo and Messi again at the next World Cup.
cristiano ronaldo is currently 38 years old, we are in 2023 and the next world cup will be in 3 years that is in 2026 and when it arrives in 2026 cristiano ronaldo will be 41 years old and looking at that age of 41 years he will be very old so the chances him playing in the starting 11 in the 2026 world cup are very low, look that in the national team of portugal there are many good strikers who are being the center of attention in big teams, being that they are younger than ronaldo so it is clear that the coach will put those good younger strikers to play at the beginning and ronaldo will be sitting on the bench
the problem arises from the fact that ronaldo is not a player who accepts sitting on the bench, so for the time being like qualifying games and euro games, the coach will always put ronaldo in the starting 11, but i very much doubt that in two years time the coach will always keep ronaldo in the initial 11, and we need to note that ronaldo is very popular and any coach of the portugal national team feels that pressure if he doesn't put ronaldo in the beginning but that will change because ronaldo's age with another 2 years will be slow and will be exposed to constant injuries