An Elf Ranger and a Dwarf Ranger do the same stuff with regards to the base class (sans the subclass features). But when you throw the subclasses into the mix, the only time they would do the same stuff is when both are members of the same subclass. There are quite a number of official WoTC subclasses for the Ranger class, and an untold number of Ranger subclasses that have been created by 3rd party companies and those D&D fans who like to homebrew.
But there is no generic Elf and no generic Dwarf in 5e. Instead there is quite a number of official elven and dwarven subraces, 3rd party company versions of both races, and homebrewed versions of both races.
The players with their DM's approval can choose any version of elf and dwarf they want. They can choose any version of the Ranger class or Ranger subclass (again with DM approval) they want.
So it's hard to say IMO if class matters way more than race.