$S$-unit and Mordell equations via modularity