Give every marker a unique, stable id. Replace or update its position to move it; remove it from the array to remove it from the map. popup is plain text, and MapLibre tooltip becomes a DOM title. Clicking a marker emits marker-click; dragging emits marker-dragend(marker, coordinates).
The complete example's saveMarker persists drag results in application state. Without that update, a subsequent render can put the marker back at its old controlled position. Use MapLibreMarker for MapLibre and MapMarker for Leaflet: their native options are different.
MapLibre accepts an HTMLElement through element for a custom marker. Create and sanitize that DOM yourself; do not pass untrusted HTML. Default markers need no custom DOM. openPopup(id) opens the popup of an existing MapLibre marker.