In the Dune film adaptation, Duke Leto Atreides possesses a pug (a dog) that appears in several scenes. At one point, Gurney Halleck, as portrayed by Patrick Stewart carries it into battle. I don't remember reading in the book that Leto had a dog at all, although I could be mistaken. In-universe, why does Leto have a pug that is carried into battle? Out-of-universe, why does he have a dog at all? It seems out of place.
It's worth noting that much of the design work for David Lynch's Dune, the costumes in particular, reference European renaissance designs (as noted on the TV Tropes webpage for this film under the heading space clothes. See here for details...) If renaissance art is taken as one of the big design influences on this film then it is less surprising that there are dogs featured as background detail. Within western art dogs have often been featured as a subject for paintings. The Wikipedia page discussing "cultural depictions of dogs" notes that "Hunting scenes were popular in the Middle Ages and the Renaissance. Dogs were depicted to symbolise guidance, protection, loyalty, fidelity, faithfulness, watchfulness, and love." See here for the whole entry.
In the picture you posted from the film, the character Gurney Halleck shouts "Long live Duke Leto" while carrying the dog. It's hard to interpret this any other way than as a symbol of loyalty. He is in effect one of the Duke's guard dogs. Perhaps the pug is a regimental mascot and he is carrying it rally the troops but we have so little background information on the inclusion of the dogs anything else is simply guesswork. You also have to wonder about the sense of carrying a pug into a pitched battle though, I can't see it bringing down many of the enemy.
To reiterate a point made by Sarriesfan in the comments, in the past many nobles did indeed have lap dogs as status symbols, so its logical that the dogs featured in the Atreides houseful and the Emperors court are included for this reason. Unfortunately I have been unable to turn up any comment or anecdote from Lynch or the design team for the inclusion of the dogs so out of universe we can conjecture but cannot say definitively.
To focus on the Emperor's court room at the start of the film, a large number of dogs on leads can be observed. Taking the dogs as a symbol within the film of loyalty, this would seem to be a comment or way of reinforcing the idea of the Emperor's power. He has many dogs on leads, i.e. he is powerful and demands obedience. Leto however only has the one dog. He is not so powerful, literally an underdog, but his dog sits comfortably and respectful on his lap. It gives him loyalty, and implies that Leto is a trustworthy character. Meanwhile Gurney Halleck, who in the novels is described as "an ugly lump of a man" and a dangerous person to have as an enemy, stops to rescue the dog in the middle of the battle of Arrakeen highlighting that for all his willingness to kill, he still has a store of compassion and humanity.
Both this film and the source novel are full of animal imagery. In the book Lady Jessica and Paul, while on the run of the Harkonnens listen to the sound of a mouse squealing when attacked by a hawk. This occurs during their first encounter with the Fremen and shows how vulnerable they are. Paul's Fremen name is taken from a a native work for mouse. To explore these animal motif's even further take a look at the scene later in the film with the Barron Harkonnen giving a cat to a captured Thufir Hawat. The cat is caged inside of what looks like a torture device, just as Hawat is caged by his enemies. Although the Barron describes the cat as a pet it is anything but. Throughout the film the Harkonnen treatment of animals is shown to be spiteful and depraved, Beast Rabban, crushing a slug like creature and drinking the juice it gives out is a notable example, this lack of respect for life a characteristic of the Harkonnens in general.
As stated earlier in this answer, we have no comment either from cast or director on the inclusion of the dogs in this film, however careful reading of the film and the scenes that they appear in show that the animal motifs within the film are important and back up character traits of the main players in the story.
To further the Renaissance connection, it’s pretty clear in the longer versions of the film that the pugs were the dogs of the court. Lynch did the full court procession/entourage with ladies in waiting, court dwarfs and advisors as part of the film’s aesthetic. You see similar depictions in period dramas like the movie “Alatriste” when the Court of Spain meets envoys from England - dogs and all. The way I saw it, Patrick Stewart’s Gurney was making his last stand as the Atreides were under siege. As the dogs are representations / symbols of the court, he’s both protecting them and going into war with them at the same time. I know it’s always looked strange from a movie-goer’s perspective, but from a historical point of view, it’s quite touching. I always loved PS’s portrayal of Gurney, and the scene where he’s reunited with Paul literally brings tears to my eyes.