Use wp_get_recent_posts with search term

It should just be a matter of setting the 's' argument of wp_get_recent_posts() (or just get_posts()) to the search term:

$args = array(
    'numberposts' => $numberposts,
    'offset' => $offset,
    'category__not_in' => array(391),
    'category' => $category,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'post_type' => 'post',
    'post_status' => 'publish',
    's' => $searchterm,
);

$recent_posts = wp_get_recent_posts( $args, ARRAY_A );

But yeah, as discussed in the comments, I wouldn’t suggest this method of display search results. If you’re using search.php correctly, the main query/loop will already contain search results.

A better question might be how to get posts from the main query into your layout function. Otherwise you’re just needlessly performing the search twice, and you’re going to be running into issues with pagination, because you won’t be using the loop and template hierarchy properly.