I noticed that optical sounds better with more detail and better intelligibility at lower volumes, but I prefer digital coax for its richer and fuller sound at normal listening volumes. Digital coax can pass greater bandwidth it seems. I am getting a max bandwidth of 24-bit / 96kHz audio over optical (through the use of an HDMI audio splitter) that sometimes can go as high as 24/192, but the stars have to align just right, otherwise it doesn't happen. I can't "make" it pass 24/192 when I want to -only when it wants to. On the other hand, coax will pass that same signal as 24/192 consistently and without issue which makes it the better all-around choice. One thing that sucks about optical is that most optical cables have plastic connectors at the end, and most optical jacks are plastic as well. This means the optical connection is mostly droopy due to the weight of the optical cable and has way too much 'flex'. It bugs me, so I find optical cables with metal connectors, but then the mating jacks are always still plastic and too difficult to upgrade. The optical connection always seems very shoddy and loose.
** Another interesting (and unfortunate) thing is that many Smart TVs have an optical out, but not a digital coax out for some reason. What this means is that you can have a 24/192 audio signal being fed through something like an Amazon FireStick 4k Max through your TV's HDMI ARC/eARC input that will show as "track quality" 24/192 onscreen through the Amazon Music Unlimited app, but it always comes out as "being played at" or "system capability" of 24/48 through the optical out of your TV. It's extremely annoying and frustrating. When this happens, it means you need to purchase (and connect) an external HDMI audio splitter to get the advertised bandwidth that's going in to the TV but not coming out of it. Preferably, the splitter has coax out as that is the more robust option that seems to reliably pass the higher bandwidths without fighting and downsampling them constantly (or leaving it to chance) when compared to optical, but only about 5-10% of splitters come with coax out. Usually they only come with optical or HDMI out (eARC) for multi-channel.
It has taken me many many hours of trial and error/ frustration/ customer support with various brands of audio products to figure this all out. You're trying to figure out which component in your signal chain is to blame and it's maddening and takes some serious dedication and sleuthing to figure out. It mostly seems to be an inability of Smart TV's themselves not being able to output the same audio resolution they're being fed with the provided audio output jacks they're made with. At some point, the TV tries to downsample the audio that comes out of it, even though in your head you're thinking the digital signal is not being internally processed within the TV and is just being passed through "as-is" since it's digital and the TV is merely acting as a "transport" from I/O. This makes a lot of unnecessary work for the consumer (on the back-end) to figure this all out on their own time since nobody explains why this consistently happens with many (or most) TVs.