You could do a procedure that returns the drop event
    procedure DragDropFile2Form(var Msg: TMessage); message WM_DROPFILES;
The implementation of it could be something like this.
procedure DragDropFile2Form(var Msg: TMessage);
var
  extension: string;
  number: Integer;
  path: array [0 .. MAX_COMPUTERNAME_LENGTH + MAX_PATH] of Char;
begin
    DragQueryFile(Msg.WParam, number, path, 275);
    {
      if the index value is between zero and the total number of dropped files,
      the return value is the required size, in characters.
    }
    if (FileExists(path)) then
    begin
      extension := ExtractFileExt(path);
      // Extracts the extension part of path like [.jpg, .png, .txt]
      if (extension = '.jpg') or (extension = '.png') or (extension = '.txt') then
      begin
        // ACCEPTED CODE TO DO WHAT YOU WANT WITH THE FILES
      end
      else 
      begin
        // BLOCKS THE FILE AND SHOWS A MESSAGE
        MessageBox(Form1.Handle, PChar('The file is not a image or text'),
          PChar('Drag & Drop'), MB_ICONWARNING);
      end;
    end;
  end;
  DragFinish(Msg.WParam);
  // This frees the resources used to store information about the drop.
end;
You also need to pass the handle of the form that is to receive WM_DROPFILES messages
procedure FormCreate(Sender: TObject);
begin
  DragAcceptFiles(Handle, True);
end;
Dont forget to add Winapi.ShellAPI to your uses
More details you can find in here: http://swepc.se/blog/2018/08/29/how-to-drag-drop-files-delphi-10/