Former Prime Minister Scott Morrison has revealed he was struggling with anxiety while in office and was medicated as a result.