Jesus spoke these harsh words against the most visibly religious group found in the synagogue. They were religious and they wanted everybody to know it.
We still have people like that. People who are dedicated, but mostly they are dedicated to their own appearance of righteousness. They want everyone to know how much they studied and how much they gave in the offering. At Easter they relish sharing the sacrifices they made and what they gave up for Lent.
Beware of that kind of testimony: When it means we are getting the glory, there is not much left for the Lord.
I have known some someone who witnessed like that. It is sad that she gave up eating bread and shared the message so prominently that nobody enjoyed the meal because this one is so miserable. I got the impression she would have a purer testimony if she had not mentioned her sacrifice. At least the Grace at the beginning would not have put everyone on a guilt trip.
In another place Jesus advised those who fast, to wash their face and be cheerful in the face of deprivation so their praise was solid and gracious. If you are making a sacrifice voluntarily, don't moan about it and lament. Let it be a joyful thing.