data-end on the label puts the switch at the far end of the row, as in a settings list.
Use a switch when the change happens straight away (turning notifications on). When it only applies after a Save button, use a checkbox.
Accessibility
role="switch" makes screen readers say "on" and "off" rather than "checked". It's still a real checkbox: Space toggles it and it submits with the form.
The label names it; the whole label is the click target.
The state shows in position and colour, not colour alone. In forced-colours mode it uses the system colours.