Hari When you say "switching", what are you switching from?
Serverless works if you have a central source of content (such as a Git repo of markdown articles). If you want users to be able to interact (comments, likes, etc), you'll need a server and database to facilitate that. Unless you plan to have users post content by submitting PRs to a content repo.
Hari Is there any way I can host flarum somewhere and have Gatsby discussion pages?
As to this, you could certainly use Gatsby to build a new frontend for Flarum independent of the current one, by interacting with the REST API. But it would be quite an endeavor.