On modern airliners, cabin altitude computers use destination airport information from the flight management computers to correctly adjust the cabin altitude to match the destination. In cases where there is no flight management system, or when the FMS and pressurization system are not connected, the pilots can set the altitude of the destination airport so that the pressurization system adjusts the pressure correctly for landing.
The pressure usually isn't equalized perfectly. At some point, the cabin is fully vented to the outside so that it can equalize to exactly the outside pressure. If there's a tiny bit of pressure remaining, it may be low enough to open the doors but high enough to be dangerous. In one incident, a flight attendant opened a door while there was still a small amount of residual pressure and was blown out of the airplane and onto the tarmac (the unlucky FA did not survive).
In cases of really high altitude airports, the pressurization system may raise the cabin altitude and leave it there, since it already matches the destination airport. For example, at many cruising altitudes, the cabin altitude may not need to go any higher than 5000 feet; and if the aircraft is going to be landing at Denver, the pressurization system can just raise the cabin altitude to 5000 feet and leave it there for landing.
In the oldest aircraft, the pilots had to adjust pressurization manually. Then it was up to the skill of the pilots (or the flight engineer) to get the cabin altitude right for arrival.