In Crusader Kings III (CK3), you can find a character's ID by enabling the debug mode and hovering your mouse over the character.
First, you need to enable debug mode. You can find the instructions here.
Once the debug mode is enabled, character IDs can be seen by hovering the cursor over a character in the game.
Note that this ID is not the Historical ID
.