Modifying the last block in a blockchain
It's true, you can have two different valid blocks (with different hashes) that both refer to the same previous block.  Call them A and B.  Then there are effectively two different branches of the block chain (so it's really a tree rather than a chain).  In such a case, each node must make their own decision as to which one to accept.  If both are at the end of the block chain, usually each node will choose the one they saw first.

In particular, a miner must decide which of A or B to use as the previous block hash in a new block.  Let's say the next winning miner chose A and mined a new block C.  Then future miners will prefer to mine on top of C instead of B, since the branch ending in C (which contains A) is longer (has more total proof-of-work) than the one that ends in B.  In the long run, the branch containing A will probably be considered as the "true" blockchain.  B becomes an orphan block and is disregarded.

If B contained transactions which A did not, and they are otherwise valid, those transactions can be included in C or some later block in the dominant branch, so they are not lost.