The collection object carries the sort UI for you: collection.sort_options is an array of { value, name }, collection.sort_by is the applied order (nil if none), and collection.default_sort_by is the fallback.
{% assign current = collection.sort_by | default: collection.default_sort_by %}
<select name="sort_by">
{% for option in collection.sort_options %}
<option value="{{ option.value }}"{% if option.value == current %} selected{% endif %}>{{ option.name }}</option>
{% endfor %}
</select>
AI tell: a hardcoded `<option>` list, or sorting products in JS. The store already exposes its sort orders; render `collection.sort_options` and let the platform sort on `?sort_by`.