<ul>
<li>1</li>
<li class="active">2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
const selector = '.active';
.const $result = $(selector).nextAll().addBack();
// или
const result = document.querySelectorAll(`${selector}, ${selector} ~ *`);
// или
const result = [];
for (
let el = document.querySelector(selector);
el;
el = el.nextElementSibling
) {
result.push(el);
}
// или
const el = document.querySelector(selector);
const siblings = el ? [...el.parentNode.children] : [];
const result = siblings.slice(siblings.indexOf(el));