Difference in ReferenceError in a block scope and global scope if a let variable is used before initialization

What’s the reason for different ReferenceErrors for these two snippets?

{
    console.log(a);
    let a;
}

ReferenceError: Cannot access ‘a’ before initialization

console.log(a);
let a;

ReferenceError: a is not defined

Same Errors are thrown if the variable is declared using const a=5;.

Also, errors vary depending on which side of the assignment operator a has been used.

a=5;
let a;

ReferenceError: Cannot access ‘a’ before initialization

var b=a;
let a;

ReferenceError: a is not defined

I read through the scope related docs on MDN but couldn’t come up with an explanation.