Create a Grid/List Toggle in WordPress Archive

If the content does not change you could surly do this with CSS. The fact that in the grid view the content itself will be different,if even slightly, means you will need to alter the loop or make a new one.

I would suggest having a look at get_template_part, this and this to see how you could use get_template_part.

So just have an event listener on the button that changes the view and according to that value serve a template part for the view. This means you will most likely want to do this with AJAX or API calls to not reload the entire page but just the changing template.

I would refrain from adding parameters to the url, unless you need the grid view linkable, meaning someone that enters the site on that link and not on the index page will have that view.

Last thing, does changing of the layout per user enhance the experience or usability of the site?