We investigate the relationship between environment and galaxy evolution in the redshift range $0.5 < z < 1.0$. Galaxy overdensities are selected using a Friends-of-Friends algorithm, applied to deep photometric data in the Ultra-Deep Survey (UDS) field. A study of the resulting stellar mass functions reveals clear differences between cluster and field environments, with a strong excess of low-mass rapidly quenched galaxies in cluster environments compared to the field. Cluster environments also show a corresponding deficit of young, low-mass star-forming galaxies, which show a sharp radial decline towards cluster centres. By comparing mass functions and radial distributions, we conclude that young star-forming galaxies are rapidly quenched as they enter overdense environments, becoming post-starburst galaxies before joining the red sequence. Our results also point to the existence of two environmental quenching pathways operating in galaxy clusters, operating on different timescales. Fast quenching acts on galaxies with high specific star-formation rates, operating on timescales shorter than the cluster dynamical time ($ < 1$ Gyr). In contrast, slow quenching affects galaxies with moderate specific star-formation rates, regardless of their stellar mass, and acts on longer timescales ($gtrsim 1$ Gyr). Of the cluster galaxies in the stellar mass range $9.0 < log(M_{*}/M_{odot}) < 10.5$ quenched during this epoch, we find that 73% were transformed through fast quenching, while the remaining 27% followed the slow quenching route.