A PRIMARY KEY
constraint is implemented by UNIQUE
index on the involved columns plus NOT NULL
constraints on all involved columns.
"Unique" means that the combination of all columns is unique. What you are worrying about is the concatenation of the textual representation of two values ('10' || '283') = ('1028' || '3')
but that's not how composite types operate at all. All fields are considered separately and as values of the defined data types, not as text representations.
NULL values are never considered to be equal, but those are not allowed in pk columns.
The order of columns is relevant for performance. The accompanying composite index preferences the leading columns. More details in this closely related answer:
PostgreSQL composite primary key