When you advance your rank or title you use up the medals required to reach that level. You’ll need to obtain new medals to advance again.
It is always better to advance your title first since titles allow you to own/control/make more cities. You can advance your rank after you advance your title.
Since the advancements use up your medals it is even more important to make sure you advance your title first and your rank second.
You also want to avoid using medals on your heroes. Medals can be used to raise the loyalty of heroes. However you can also use gold to improve the loyalty of heroes. Since gold is easily replaced and since you cannot buy medals it is best to save your medals for titles and rank advancements.
The number of cities you can own is based on your title (Knight, Baron, etc.)
You start out as a civilian. As you earn promotions to your title you can build additional cities. For each new title you receive you can own 1 more city. Think of it in terms of King Arthur or the Queen of England bestowing upon you a title like “baron”, etc. Titles are what give you rights to own more land (aka. own more cities.)
Ranks are different than titles. Ranks are recognitions you receive from the military (Colonel, Lieutenant, etc.)