I have never had a problem with spending too much time on Facebook or Twitter on any of my iOS devices. However, I know some other people probably do spend too much time in iOS. It is iOS 12 to the rescue with the new Screen Time feature. I think it will be helpful to many people. This article explains how to set it up and how it works.