His contract with Real Madrid will expire in June, 2024. I heard a rumor, Ancelotti offers him to be apart of Real Madrid coaching staff. If Modric decides to retire in the end of this season, he can accept the offer made by Ancelotti. But if Modric still wants to continue his career as a professional player. Modric must leave Real Madrid since there is no contract extension. There are a rumor of the interest from Saudi teams, they will give Modric a huge salary of Modric wants to play in SPL. Now, it depends on what the decision wants to make by Modric.
I don't think the departure of Modric won't give a serious impact. There are already enough top midfielders to replace Modric's role. Camavinga, Tchouameni, Bellingham, and Valverde are some players who have the same position as Modric. And we must realize that Modric is getting rarely to play full time recently. It indicates that Real Madrid no longer too depends on Modric anymore.

Sources:
-
theathletic.com-
forbes.comObviously, there is no point in renewing the contract with a 38-year-old football player, perhaps it will be posible if he wants to play another season in the team, but you are right, the competition in such a team is too high, and it will be more difficult for him in the next years. Any decision will be good for him, if he goes to Saudi Arabia, he will be able to earn very good money, if he stays to work in Real Madrid, he will stay with his favorite club, which is perhaps even better.