Know that this is an incredibly complex question in that sense: when we are speaking of "dragon", "wyrm", "drake", "wyvern", we are referring to modern terms, and not necessary at all to medieval terms and what they meant for medieval people.
In early Middle Age dragons are personification of evil, and especially Satan. They are generally fought by saints who used them to show the all mighty power of the true God (according to the said saints!). Those saints are Saint Georges, Saint Michel, Saint Marcel, or even female saints Saint Marguerite, Saint Marthe.
In later period, they are fought by knights in Middle Age novels as a kind of rite of passage. They are much more the mandatory tough enemy much more than a final epic fight.
Dragon representation in Middle Age
Now let's take a look at dragon as seen by artists during Middle Age (once again let's forget here modern thinking, let's look at what artists painted during the Middle Age).
Here is a representation of the Archangels fighting the Beast of the Apocalypse (picture from the Apocalypse glosée). Notice, the dragon has 6 heads on the front and one head on the tail (The Beast with the seven heads and ten horns), it's bipedal, and has feathered short wings echoing the large wings of the archangels.
Here is Saint Liphar and the dragon from "Les grandes heures d'Anne de Bretagne". Bidepdal small dragon much more looking as a fancy dog than anything else (the former arch-enemies are now the pets of saints, that's the power of God (!)).
And here from Queste Del Graal Percival and his lion fighting the dreaded serpent. Once again a bipedal creature with small wings.
And to finish, here is a depiction from Germany of Sigurd killing the dragon Fafnir. This is from the Ramsund carving. Notice that Fafnir the most renown dragon is depicted as a giant snake.
I could go on and on to demonstrate that: Dragon in Middle Age are not specifically four legged creatures with wings. That doesn't mean they are not. that means that when they are it is only one of the way there are shown.
Regarding the term "dragon" and "wyrm"
Wyrm is known in English to depict the creature fought by the hero Beowulf. That creature is either referred as "wyrm" or "draca". For any decent Tolkien reader (which I am not) this is totally important just because Tolkien was a huge fan of Beowulf and his depiction of Smaug is rooted in that fight. And thus part of our modern tradition is.
Wyrm is an old English world which altered later into worm.
Thomas Eliot's dictionary (1542) only know draco, onis, a dragon.
Samuel Johnson's dictionary (1755) give us this sense for worm: 1- A small harmless serpent that lives in the earth, 2- A poisonous serpent.
If you take a look now at English literature:
- In Sir Thomas Malory's La Morte d'Arthur (1485), dragons are common references, wyrm or worm are never mentioned, they are not existent.
- In Edmund Spenser's Faerie Queene (1596) dragons are relatively common (it is the mandatory rite of passage of the Redcross Knight), when worm never occurred as fantastic creatures (they "appeared" as our modern worms)
So what it seems that in early English, wyrm and dragon were equivalent, as English progressed, worm recessed at first as a small 'serpent' before simply vanishing from the language, letting only the term dragon survive.
The winged serpent
I would like to notice something, most of the depiction of the dragon is roughly a winged serpent, and winged serpents are incredibly common in mythologies and ridiculously old. Example: Egypt is the reunion of lower and upper Egypt and each of those lands were associated with a patron goddess. The patron goddess of lower Egypt was Wadjet a winged serpent. This is so remnant in Egypt that when Herodotus visited Egypt he mentioned he saw such winged snakes in Bouto. "The snake has a form of a water snake and bears wing-like membrane that lack feathers, quite similar to the wing of a bat".
Regarding the term Wyvern
At the origin, wyverns, aka Guivre, Vouivre or Vipera, are creatures with ears like horns described by Pliny whose reproductive behaviors is that the female is eating the head of its male when mating. During the middle age that creature will gain most of the features of the dragon as shown here:
If you take a look at Pliny's description of the wyvern and take a look at the Ramsund carving, you will see that the most renown dragon is a... wyvern!
Notice that in French la guivre or la vouivre is a kind of snake. As in Italy. The symbol of the Visconty of Milan is la guivra a snake eating a baby.
Regarding the term "Drake"
Drake is coming from the old English term Draca (one of the term defining the last enemy of Beowulf); coming from the latin draco, dragon. Drake is the common name of the youngster of dragons. No such reference exists whatsoever in Middle Age, it is purely a modern term.
The dragon in heraldry
Heraldry is one of the most codified thing in the world, in the traditional heraldic world, and in English countries ONLY (what follows is so entirely false for France, Spain, Italy, Germany, Nederlands, etc.):
- Dragons are four legged, 2 bats winged creatures
- Wyverns are 2 legged, 2 winged creatures
- Wyrms are not represented
A final warning: Even that is quite false in the history of English heraldry (which by eon I am not an expert) and you will find dragons with 2 legs and wyverns with four!
During Middle Age what are the differences between Wyrms, Dragons, Wyverns and Drakes. Simply: Drakes are nonexistent. Dragons, wyrms and wyverns are mostly interchangeable terms, when wyrms will disappear progressively from the English vocabulary.
How many legs have they? As much as the artists painting it want (0, 2, 4)
How many heads? As much as the artists painting it want (0, 2, 4, 7)
How many wings? As much as the artists painting it want (0, 2, 4)
Feathers? Scales? As the artists want.
It is my knowledge that dragons in Tolkien are following this pattern. Smaug is described as a "wyvern" still referenced as a dragon, and Glaurung is named the Black Worm. I am by eons not even remotely any sort of expert in Tolkien.