stm32 uart issue serial monitor vs logic analyzer
You are seeing the numeric value 5 encoded as the ASCII character '5' which has the hex value 0x35

00000101 binary is 5, a value

00110101 binary is 0x35 (48 + 5 decimal) which is the character code for a printable '5'

Also worth remembering that if you try to decode the logic analyzer or scope waveform by eye, it will be sent LSB first, and there will be additional framing.