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.
Continuing his career in the Saudi pro league if he does get an offer and still wants to play is a good choice not because the salary is bigger but he might still get a place in the starting XI at the club even though he is no longer young.
But of course it is not easy to move to SPL because there are many things that have to be adjusted, including the weather because the weather in Europe and Saudi Arabia is very different which might make him not very comfortable.
But for some reason I see him as a player who really loves Real Madrid, so if there really isn't a contract extension, maybe there will be, considering that Real Madrid has extended Toni Kroos' contract for another season, so there's an opportunity for Modric to become the coaching staff it could be his decision later.