Still a year or two back, Babel was still transpiling let and const to var, albeit, if it find two variables or constant declared with let and const respectively across different blocks in the same function, it would be given different names.
The main reason was that, few browser weren't updated to support ES6 syntax. Currently, most of the browsers support ES6/ES7 codes without transpiling, Firefox even supports some of the 2021 feature. You can check the compatibility here.
The reason why there are many codes and examples still use var is because, not every dev has gone through their repos and updated the code.
So should you use var now?
No! Unless there's really, really, reeaaally a specific reason for you to use var, use let or const.