How shall I semantically distinguish to be pedantic and splitting hairs while they both indicate the same message about a person who is paying too much attention to some unnecessary details?
To be pedantic means to be excessively concerned with minor details.
"Splitting hairs" is a kind of pedantry, but more specific. It is used when someone focuses on a minute difference between two things.
Example of pedantic:
Person 1: This record is from the 1980s.
Person 2: Actually it was originally released in 1979 and then re-released in 1981 so technically it is a 1970s record.
This is pedantry because person 2 has corrected a minor detail.
Example of splitting hairs:
Person 1: This is a great vinyl record.
Person 2: Technically it is polyvinyl chloride.
I would say this is "splitting hairs" because person 2 hasn't really corrected a mistake - records are commonly referred to as 'vinyl', and polyvinyl chloride is a derivative of vinyl - but they have drawn attention to a difference that doesn't really matter.
The two are similar in the focus on details, however, pedantry involves an educational arrogance, or a pretentious display of learning or college pedigree.
Your question is pedantic in that it is excessively concerned with correct details (which of two similar terms should be used). The answerers suggesting differences between the two terms are splitting hairs – that is they are positing minor technical differences between two very similar things.
The OED defines splitting hairs as:
b. to make fine or subtle distinctions, esp. in argument or controversy; to be over-subtle or captious.
While a pedant (or someone who is pedantic) is:
2. A person who excessively reveres or parades academic learning or technical knowledge, often without discrimination or practical judgement. Hence also: one who is excessively concerned with accuracy over trifling details of knowledge, or who insists on strict adherence to formal rules or literal meaning.
So I'd say "splitting hairs" is actually a subset of pedantic. I disagree with @Astralbee's examples, I think they're both splitting hairs--they are both making fine or subtle distinctions after all.
A better example of something that is pedantic but not splitting hairs would be something like the quote from Nature: weekly journal of science in 1993:
The book's arguments are not well served by a somewhat pedantic writing style, too full of fancy words such as ‘evidencing’, ‘processual’,..and ‘juridicial’.