If your SharePoint list does not already have a field to track the custom order (since users can drag and drop), you should add a "Position" or "Order" column to your SharePoint list. This column can be a Number field where you manually or programmatically set the order for each record.
If you allow users to drag and drop records, you’ll need to update the "Position" column to reflect the new order.
You need to modify the Items
property of the gallery to order the records based on the "Position" column instead of the default ID.
SortByColumns(YourSharePointListName, "Position", Ascending)