It is canine tapeworms. When tapeworms die - they die from "bottom" to "top". Tapeworms are made up of segments - each segment contains reproductive organs. These organs mate and create eggs - when the segment is full of eggs - it breaks away from the "mother" tapeworm.
During a clenase - the segments near the bottom will "die" and leave first. The head of the tapeworm is the last to go. This is because the tapeworm will try to keep its head healthy. It can regenerate itself from only the head.
Canine tapeworm segments look just like rice grains.