On macOS 14.3.1 Sonoma this issue is present. Based on the other answers this is a regression as it said to be fixed before on Mavericks.
Anyway, my workaround for now is to use the tool called BetterDisplay to create a small virtual screen, and position it between my two monitors. Once the monitor is set up, I position it between my two real screens, so now any shadows on one will not appear on the other. As a trade-of now I have bit of a "dead" zone between my two screens. Since I never use any apps in a way that a single window would span both screens, it's okay for me.
Now it is not without caveats. In theory it is possible to move a window to this screen basically "loosing" it. Also there's a bit of a virtual gap now between the screens so moving the mouse in between can take a bit more movement.
Although the application allows configuring custom aspect ratio and resolutions, very wild values are not working. Ideal for me would be 50x1440, however such screen just does not work. I also found that making monitors taller than wide are less likely to work, so it's best to try to make a very wide one and turn on rotation.
It is possible however to make a 32:9 superwide screen, set it to be rotated and use a resolution of 540x1920.
Probably with some trial and error maybe even narrower screen could be created, but as far as I saw going below 540px is impossible. Even thought I've configured some valid lower resolutions, such as 90x320, switching to it was not allowed by the OS.
Note: To reduce the gap one could also in theory use a virtual screen not as a spacer in between the real screens, but in a way that it is above/below them. To position the screens the OS requires that each screen should has at least one side that touches another. So it is possible to position two screens 50px from each other (whereas I think 50px should be enough for the shadow) using an utility screen, but the problem is that the OS does not allow the mouse cursor to pass over any area not covered by screens. So while such arrangement would be ideal to hide the shadow, but not add a large gap, it is not practical as this way the only way to move the cursor from one to the other is to follow the path where the virtual screen touches the real ones.