The relatively new :has() pseudo-class can be combined with the next-sibling + combinator for some nifty CSS selections. I used this selection today:

.post-content blockquote p:last-of-type:not(:has(+ footer)) {
    margin-bottom: 0;
}

Which can be read as, “select the last paragraph element within blockquote elements within elements with class post-content which are not followed by a footer element.”