iPhone: it's supported if Settings → Cellular (Mobile Data) has "Add eSIM" or "Add Cellular Plan". Galaxy: it's supported if Settings → Connections → SIM manager has an eSIM entry. If the menu isn't there, it likely isn't supported — but since this can vary by launch region and software, also check the manufacturer's specs for your exact model number.
On iPhone, go to Settings → General → About and check "Carrier Lock": if it says "No SIM restrictions", there's no lock. Devices bought overseas, used, or under contract may be locked; if you're unsure, the accurate way is to ask the carrier that originally sold or activated the device about its "SIM lock (unlock) status".