Buy the modem, and a good router, configure the router properly and you should have no issues with your network. When I had xfinity they would not let me change settings like the wireless channels and other items, they were not editable because xfinity knew what the best settings were for me. Everyone around you was on the same channel 6 on wireless and it made a lot of interference and my network kept crashing, so much for knowing and optimizing the network. I called and asked them to let me edit it, and they said they don't allow editing because they optimize the network for best performance. So I threw that shit back at them and bought my own hardware.
As far as the router goes, get what you can afford. Any newer router above the ~$150 price point should be sufficient, if possible, try to plug in as many things as you can, helps with the network performance. I have my ps4, servers, and gaming pc, all on lan, this way only my mobile devices and tablets are on wifi.