opto isolator used to change voltage
Yes you can get voltage shifting and isolation using opto couplers.

Be warned that low cost couplers used in saturating mode, that is the 'obvious' way to use them to transmit logic signals, are fairly slow, a 10kHz waveform should go through, 100kHz won't. As long as you allow for this in your choice of PWM speeds, you should be OK.

They work much faster in non-saturating mode, but then you need a little more hardware around them.

You can get premium couplers that work to MHz or 10s of MHz, if you really need low latency.

If you don't need isolation, there are several ICs that will handle level translation, or use discrete transistors.