I found the answer. Notices in the Block Editor would require JavaScript code.
( function( wp ) {
wp.data.dispatch('core/notices').createNotice(
'error', // Can be one of: success, info, warning, error.
'Error Message.', // Text string to display.
{
isDismissible: true, // Whether the user can dismiss the notice.
// Any actions the user can perform.
actions: [
{
url: '#',
label: 'View post'
}
]
}
);
} )( window.wp );
Link: https://developer.wordpress.org/block-editor/tutorials/notices/