Use the “Fold all” command (find it in the command palette). If this hides the headings you want to delete, click or tap the start of the heading they’re under to unfold it (there’s a triangle you click or tap but it only appears when you touch or hover over it).
Select the headings you want to delete (select all the way to the end of the ellipsis (…) at the end of the last one.
Delete. The headings and the content folded under them will be deleted.