Cookies configuration

Is it possible to redirect users from Cloudflare according to the cookies??
for example:

when request homepage with cookie device_view=full it will return full version view

also when request homepage with cookie device_view=mobile return mobile version view
if request with no cookie it will reach to server to get cookie “first time”

You could probably achieve this with workers.

Thanks for your reply but would you mind explaining how?
as I didn’t use workers before.

https://developers.cloudflare.com/workers/about/ should have everything.