It won't affect their decision. It just means they know who needs extra support, it really doesn't affect your chances of getting in.
Universities contact those with disabilities in order to put into place arrangements and things like Disabled Students Allowance and exam arrangements.
I think that if you didn't want to put it on UCAS you contact the university once they've made you an offer to tell them about your mental health problem.
I've applied to university three times in total, each time declaring mental health and each time getting offers.
I'm just about to start my new university this month and they are brilliant with helping me with my mental health.