Since electric cars will eventually displace all forms of internal combustion engines, the answer to this question will change over time.
I have developed a shifting technique on my 2016 Toyota RAV4 hybrid, where when reversing from the parking location I switch to "D" when slowly moving rearwards. The shift is extremely smooth and the result is that the backwards momentum continues to decrease and eventually turn to forwards momentum. The reason this works is that Toyota's hybrids do not have a transmission. They have a power split device that is used to electrically adjust the relationship between engine RPM and wheel speed.
On all purely electric cars, you probably can do the same. There is no reason an electric car would not do a smooth shift between "D" and "R" at speed. Of course, the electronics may disallow the shift if the speed of the car is over a certain threshold.
However, what about non-Toyota hybrids? It's anybody's guess, basically. Some hybrids do actually have a conventional transmission, and therefore, may not allow shifting between "D" and "R" at speed. I am aware of at least some non-Toyota hybrids that use a construction similar to Toyota, namely a power split device where one shaft contains the internal combustion engine (ICE), another shaft contains the motor generator 1 (MG1) and the third shaft contains the motor generator 2 (MG2) and is connected to the wheels. This construction is sometimes called an electric CVT (eCVT). On all hybrids of this type, it is possible to shift between "D" and "R" at speed.