There are hundreds of models of digital piano, and thousands of models of guitars. Their differences are sometimes subtle, sometimes not, and some differences are more about how you use it than how it sounds. Like a digital piano may have more physical buttons, or rely more on menu diving or obscure sequences of key presses to change parameters, that's a matter of usability. It may or may not have line or MIDI out, which doesn't affect the sound but affects how you can connect it to other things.
Synth models have those differences, but they can also have quite a large difference in sound. See this question, which shows that even something basic like a square wave can be very different from one synth to the next. (Presumably more so with analog synths, but there's nothing stopping a digital synth from doing the same, either to get a distinct sound or to replicate an analog model.) Plus differences of monophonic vs polyphonic (one or several notes at the same time, if several how many) and monotimbral vs multitimbral (one or multiple sounds simultaneously).
The parameters of different synths are rarely the same. Filters are different. Modulation sources and targets are at least as important and can vary a lot, semi- and fully modular synths generally have more options to change the sound by routing signals differently. There are different synthesis mechanisms, subtractive/additive/FM/wavetable/whatnot, they differ in what types of sounds you can make and how easy it is to understand how to get the sound you want.
But it may be true that if you are looking at say two digital subtractive synths in the same price range, there may not be a whole lot of difference in they types of sound they can make, so the decision may hinge on other factors. Try them out in person if possible, or at least check reviews and sound samples on Youtube or similar.