Here's a test circuit for your switch:I have already tested the LED. The LED works well. The problem can only be in the switch button and in the related code. But I do not understand how to find the real problem
Does it work as expected? If yes, then problem is not switch. If no, get a new switch and start over at post #1.