I think all formats can sound great, but sometimes they don't. An analogue recording can be made hastily with less than ideal equipment, and it won'e sound all that good. It is my understanding that most recordings made after 1980, unless otherwise indicated, were stored digitally. If they were stored at 192/24 instead of 44.1/16, they will sound much better.
It is in the high treble where digital, however, cannot quite sound like analogue. A record itself is an analogue source. It reproduces the music wave in its grooves. If you put a sewing needle (as small as possible) through a cone of paper and put it in a record groove, the paper cone will act as a speaker and you will hear the recorded music. When a cartridge turns that into an electric signal, the signal is also a wave and nothing is lost.
Digital must use on/off bits to reproduce a sound wave through a DAC. The highest registers are very jagged and complex and something will be lost in the sampling. Software attempts to interpolate what is lost, but you can generally hear in the decay (of cymbals, for example) that the analogue sound is not all there. Of course, you'll need an analogue record and a digital recording to compare to one another to really hear it.
As I have mentioned before, certain very hi-rez digital recordings sound pretty good. One example is Patricia Barber's "Clique" through either Qobuz or Tidal. I like the album, but I won't bother to buy it because the digital recording is very good. It is unusual, though.
One of my favorite recordings is Alice Coltrane's "Journey Through Satchidinanda." I wore out the original copy after more than fifty years and bought a reissue before I knew about reissues often being from a digital source. I can't listen to the album. It has so much sound in the treble region which the digital recording captures badly. When I have a few extra dollars, I'll buy the reissue that was cut from an analogue master. In the case of this album, at least, it makes a big difference between analogue and digital.

