The majority of the time, the number of characters varies.
".htm" is reminiscent of Microsoft operating systems, where the file system previously limited file name extensions (the part of the file name following the dot) to three characters.
".html" is reminiscent of Un*x operating systems, which did not have this restriction and were used for all serious internet work at the time.
Pragmatically, the two are interchangeable.
The distinction is cultural. Some consider ".html" to be more formal. The same people look down on Microsoft operating systems and see ".htm" as an obnoxious reminder of their limitations.