for eg. A device driver is about exposing an interface for other programs being run on your computer, to access and control a device...
https://m.youtube.com/watch?v=juGNPLdjLH4 this is a decent crash course on that.
You can create a toy USB device using an Arduino or something that can send / receive information to your PC. Eg: https://m.youtube.com/watch?v=yTc2GLXfCOY .
Then it's a matter of just understanding what the subsystem you're interested in writing drivers for your OS does, how to make it do something, just write code. Storage devices, graphics devices, etc...
A raspberry pi can be a decent starting point for these experiments too.. eg. Writing a bare metal operating system for the raspberry pi https://github.com/babbleberry/rpi4-osdev