It is a very complex question.
Real short answer:
In the medieval feudal system in continental Europe the owner of a manor was a feudal lord. The feudal ruler of an ancient Roman city state or its equivalent in a non Roman region was a count. The feudal ruler of a large area was a Duke.
Ideally all lords were vassals of their count, all counts were vassals of their duke, and all dukes in a kingdom were vassals of their king. Thus the feudal hierarchy would be simple with only four steps, from lord to count to duke to king.
A baron was a lord not dependent on any lord except for the King.
In England nobody was considered a noble unless he was a baron or higher, and all nobles were more or less directly subordinate to the king & not subordinate to other nobles.
Of course the feudal system was more like the feudal lack of system, and it got a lot more complicated than this.
For example, a lord could acquire a bunch of lordships and become a vassal to a number of different lords, counts, and dukes. Thus the numbers of steps between a lord and his king could be different for each lordship that he owned, and a lord could acquire lordships in different kingdoms.
An example of the accumulation of titles and fiefs is from Henry VI Part 1 when Sir William Lucy meets the French leaders after the Battle of Castillion:
LUCY But where's the great Alcides of the field, 60
Valiant Lord Talbot, Earl of Shrewsbury,
Created, for his rare success in arms,
Great Earl of Washford, Waterford and Valence;
Lord Talbot of Goodrig and Urchinfield,
Lord Strange of Blackmere, Lord Verdun of Alton, 65
Lord Cromwell of Wingfield, Lord Furnival of Sheffield,
The thrice-victorious Lord of Falconbridge;
Knight of the noble order of Saint George,
Worthy Saint Michael and the Golden Fleece;
Great marshal to Henry the Sixth 70
Of all his wars within the realm of France?
JOAN LA PUCELLE Here is a silly stately style indeed!
The Turk, that two and fifty kingdoms hath,
Writes not so tedious a style as this.
Him that thou magnifiest with all these titles 75
Stinking and fly-blown lies here at our feet.
Of course since those were English titles the Earl of Shrewsbury was directly subordinate to the King instead of to other lords for all of them.
And similarly counts, margraves, dukes, other nobles, and kings often acquired various lordships, counties, duchies, fiefs, principalities, and kingdoms. Thus someone could be the vassal of another lord in respect of a fief he held from that other lord, while that other lord could be a vassal of the first lord for another fief. And someone could become the vassal of himself, or the vassal of someone who was a vassal of himself.
Here is a list of the titles claimed by Emperor Charles V about 1530-1556:
Emperor of the Romans;
King in Germany, of Castilia, Aragon, Leon, both Sicilies, Jerusalem, Hungary, Dalmatia, Croatia, Navarra, Grenada, Toledo, Valencia, Galicia, Majorca, Sevilla, Sardinia, Cordova, Corsica, Murcia, Jaen, the Algarves, Algeciras, Gibraltar, the Islands of Canary , of the Indies, Mainland of the Ocean sea;
Archduke of Austria;
Duke of Burgundy, Brabant, Lotharingia, Styria, Carinthia, Carniola, Limburg, Luxembourg, Gelderland, Athens, Neopatria, Württemberg;
Landgrave of Alsace;
Prince of Swabia, Asturia, Catalonia;
Count of Flanders, Habsburg, Tyrol, Gorizia, Barcelona, Artois, Burgundy Palatine, Hainaut, Holland, Seeland, Ferrette, Kyburg, Namur, Roussillon, Cerdagne, Zutphen,
Margrave of Burgau, Oristano, Gociano, the Holy Roman Empire;
Lord of Frisia, the Wendish March, Pordenone, Biscay, Molin, Salins, Tripoli, Mechelen;
Obviously Charles V was his own vassal many times over, and the vassal of other rulers for some of his fiefs.
In another example, there were the princes of the Holy Roman Empire. The princes were a group of nobles having various titles but all having more or less the same powers as dukes and were immediate vassals of the emperor.
From lowest to highest the titles used by princes of the Holy Roman Empire were princely count, landgrave, margrave (equivalent to the English marquess), count palatine, prince, duke, grand duke, and archduke.
Even though a duke had a higher rank than a landgrave, a duke would not have a landgrave as his vassal, since a landgrave was a prince of the empire and an immediate vassal of the emperor. Even though a duke could have ordinary counts as vassals, he wouldn't have a princely count as his vassal since a princely count would be a vassal only of the emperor.