How to create custom search form function including post “tags”

If you are using WP_Query you can search for tags using this code:

$query = new WP_Query( array( 'tag' => 'cooking' ) );

For more tag options see this page: https://developer.wordpress.org/reference/classes/wp_query/#tag-parameters