Get interface translation LID (Locale Id?) using source string value
OK: Figured it out through trial and error. Here's the code:

$db = \Drupal::database();

$query = $db-&gt;select('locales_source', 'ls')-&gt;
    condition('source', $source_string)-&gt;
    fields('ls', ['lid'])-&gt;
    range(0, 1);

$lid = $query-&gt;execute()-&gt;fetchField();


UPDATE: Found a cleaner way. Here's the code:

$storage = \Drupal::service('locale.storage');
$string = $storage-&gt;findString(['source' =&gt; $source_string]);

if (!is_null($string)) {
  $lid = $string-&gt;lid;
}


I'm using this now in a custom module. Seems to be working well.