Each block has in its blockheader the hash of the prior block. If you replace a block you would also have to replace all blocks after it plus an additional block for your modified chain to to be the longest.
So to change a block 10 blocks deep in the blockchain would require solving 11 blocks before the "good miners" collectively solve 1 otherwise your modified chain is still shorter and falling behind.
On edit: missed this ...
The replacement would, by design, have the same hash but different content - content that, for whatever reason, favors me as the attacker.
The odds of your producing a block with different content and the same hash is 1 in 2^256. There isn't sufficient energy left in our star to accomplish that even given a planetary sized super computer operating at the thermodynamic limit for the next four billion years.