A photocatalytic chemodivergent reaction for the selectivity formation of C-S and C-N bonds in a controlled manner was proposed. The reaction medium, either neutral or acidic, is critical to dictate the formation of 2-amino-1,3,4-thiadiazoles and 1,2,4-triazole-3-thiones from isothiocyanates and hydrazones. This is a practical protocol to achieve the chemoselectivity under mild and metal-free conditions.