You don’t need to manually detect the start or end of data when using a standard UART interface — this is handled by the hardware. Each byte is framed by a start bit and one or more stop bits, so the receiver automatically reconstructs complete bytes. At the output, you receive a fully formed byte stream, ready for processing.
Typically, commands are organized as packets with a standard structure that includes fields such as packet length and a checksum. This way, you simply read the incoming byte stream as packets in FSM: if a packet validates correctly, you process it, if there’s an error or a timeout, you reset the receive buffer and start over. This process repeats continuously in a loop.