Efficient hybrid method for the modal analysis of optical microcavities and nanoresonators