The binary Hamming codes with parameters \([2^m-1, 2^m-1-m, 3]\) are perfect. Their extended codes have parameters \([2^m, 2^m-1-m, 4]\) and are distance-optimal. The first objective of this paper is to construct a class of binary linear codes with parameters \([2^{m+s}+2^s-2^m,2^{m+s}+2^s-2^m-2m-2,4]\), which have better information rates than the class of extended binary Hamming codes, and are also distance-optimal. The second objective is to construct a class of distance-optimal binary codes with parameters \([2^m+2, 2^m-2m, 6]\). Both classes of binary linear codes have new parameters.