Same thing happened to my Galaxy S7. 5G would keep disconnecting and would show "internet not available" 2.4G is perfect though. what i did was
1. turn off smart network switch 2. turn off bluetooth scanning. 3. download wifi analyzer app from play store 4. switch router to the best channel...