How to access entities' "natural sort order" in Rules/Buttons/scripts?

Entities can be (re)ordered manually via dragging (i.e. in a Card or List view).
How can such entities’ relative order be determined or set in a Rule/Button/script?

Hi, Matt!
While we’re thinking about the answer, would be glad to hear more details about your use case, really curious about it))))