I think the simple answer is "you don't" - $DB->execute() doesn't support returning a result and Moodle, in general, does not support inserting into tables without the $CFG->prefix (because then multiple Moodle sites sharing the same DB would end up clashing with one another whilst writing to the same table).
I suppose you could do a query in order to get the highest ID in the table, but, again, there isn't really a clear use-case (that I'm aware of) where it would be desirable to do this in the first place.
Rename the table to include the prefix, if it is a table that should be managed by Moodle. If it is not, then consider using some sort of API to manage it, rather than trying to use the Moodle
database functions to access it.