Unfortunately, it is no longer safe for kids to do that today, at least not around neighborhoods. The Halloween scares were fairly new when I was a child. I can remember hospitals setting up equipment for people to bring in the candy to have it x-rayed to detect glass, razor blades, and other nasty things. I tend to suspect, for the most part, that the x-raying of the candy did more harm to the kids than anything in the candy. This, too, was not always the case and trick or treat has pretty much become a thing of the past just as x-rays of your feet to see if your shoes fit properly are no longer in shoe stores.
College students are rather a different lot.
Halloween has always been a great excuse to party for them and trick or treating was something that was done on campuses around the country. This practice has pretty much stopped, except in the dorms. However, those of us who were in college in the 1970s found new and interesting ways to celebrate the occasion. The year I had my eyes taken out was not a particularly good one for me. A number of things happened to make it a year worth forgetting.