In Salesforce Lightning Experience, we can use “Rich Text” standard component on the Lightning Record Page to display or show error or warning message at the record level.
Enable “Display as card” option to display the text with white background.
Use “Set Component Visibility” to display the message only when the condition(s) is/are met.