Most tyres have small raised bars in the main grooves, called tread wear indicators. When the tread is worn level with them, the tyre is at the legal limit. A 20p coin is a rough check: if the outer band of the coin shows when it is pushed into the main grooves, the tread may be close to the limit.
Grip in the wet falls away well before the limit, so many drivers replace tyres at around 3 mm. Age matters too: cracking in the sidewall or between the tread blocks means the rubber is perishing, even on a tyre with plenty of tread left.