Use a web browser and sign in with Apple ID say example1@yahoo com tat is used in iPhone , and select few mails from web account and delete them the steps are mentioned in the link https://help.yahoo.com/kb/SLN28054.html
Note - By default the Select All icon selects 50 emails at a time, you can select more by scrolling down and then clicking the Select All icon..
From iPhone Delete emails on your iPhone or iPad - Apple Support
Delete multiple emails at once
- Open Mail and go to your Inbox.
- Tap Edit in the upper-right corner, then individually select the emails that you want to delete, or tap Select All. To select multiple emails quickly, swipe down through the checkboxes.
- Tap Trash or Archive. If you only see Archive, touch and hold Archive to see other options like Trash Selected Messages.
To delete a large number of emails, you might find it easier to use your email provider's website.