What's the difference between a piece of and a bar of? A bar of soap is a piece of cheese. Why use piece and bar separately?

What's the difference between a piece of and a bar of? A bar of soap is a piece of cheese. Why use piece and bar separately?

A piece of
Such as a piece of paper
Loaf a loaf of bread
Bar, bar
Bar itself means bar or bar, so it is usually used to describe long bar or bar like objects
Piece has the meaning of piece, block, piece and part, which is widely used. Many uncountable nouns can be described by piece
The uncountable nouns modified by bar can be replaced by piece
On the contrary, not every piece of uncountable nouns can be modified with bar
Piece is more widely used than bar
So a picec of soap is OK